interclubs
asked on
Replace item in array (php)
Let's say I have an array like this:
array(
name=>'sam',
age=>'22',
weight=>'222'
)
How can I update the name element in the array? to set it to 'John' for example....
array(
name=>'sam',
age=>'22',
weight=>'222'
)
How can I update the name element in the array? to set it to 'John' for example....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://us.php.net/manual/en/function.in-array.php
if (in_array('sam', $my_array)) echo "We found Sam!";
The complete list of array functions is here:
http://us.php.net/manual/en/ref.array.php
HTH, ~Ray