Associative array/Creation: Difference between revisions

Content added Content deleted
(added php example)
Line 103: Line 103:
echo($array['foo']); // bar
echo($array['foo']); // bar
echo($array['moo']); // Undefined index
echo($array['moo']); // Undefined index

//alternative (inline) way
$array2 = array('fruit'=>'apple, 'price'=>12.96, 'colour'=>'green');



===Iterate over key/value===
===Iterate over key/value===