2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by davecoventry
0
$arr[2]=150;
$arr[231]=163;
$arr[235]=1121;

Um. Yes.

$numbers=(2=>50, 231=>63, 235=>121);
foreach($numbers as $number){
  if($number==63){
    $number=163;
  }
}

Of course if I knew that key 231 held the number to be changed, it would be as easy as you suggest.

Sorry I didn't make myself clear!

(And, indeed, thanks for the response!) :~)

0

Um. Yes.

$numbers=(2=>50, 231=>63, 235=>121);
foreach($numbers as $number){
  if($number==63){
    $number=163;
  }
}

Of course if I knew that key 231 held the number to be changed, it would be as easy as you suggest.

Sorry I didn't make myself clear!

(And, indeed, thanks for the response!) :~)

Actually, just answered my own question:

$numbers=(2=>50, 231=>63, 235=>121);
foreach($numbers as $key=>$number){
  if($number==63){
    $numbers[$key]=163;
  }
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.