Anonymous user
Associative array/Creation: Difference between revisions
added php example
m (Categorizing programming examples) |
(added php example) |
||
Line 93:
let quux = try Hashtbl.find hash "quux" with Not_found -> some_value;;
==[[PHP]]==
[[Category:PHP]]
$array = array();
$array['foo'] = 'bar';
$array['bar'] = 'foo';
echo($array['foo']); // bar
echo($array['moo']); // Undefined index
===Iterate over key/value===
foreach($array as $key => $value)
{
echo('Key: '.$key.' Value: '.$value);
}
==[[Perl]]==
|