<?php $my_array = array('hey' => 'man'); //change man to girl... $my_array['hey'] = 'girl'; print_r($my_array); ?> PHP:
The method of changing a value in an array is different depending upon what info you have to start with. If you have the key of the value you want to change use this: $array['key'] = 'new value'; PHP: If you have the value and need to find the key use this: http://www.php.net/manual/en/function.array-search.php or http://www.php.net/manual/en/function.array-keys.php then use the key(s) found using one of those functions to change the value(s) in the array (using the method given above).
An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other array s, trees and multidimensional array s are also possible. Please visit this site for knowing better information about PHP: http://php.net/manual/en/language.types.array.php