Associaive array insert order & iteration
Posted: Sun Apr 12, 2009 11:46 am
Easy n00b question here:
Does the iteration order of an Associative array always match the insertion order?
For example:
Am I always guaranteed to see?
jim smith
bob jones
tom baker
Thanks!
Does the iteration order of an Associative array always match the insertion order?
For example:
Code: Select all
$name = array('jim' => 'smith', 'bob' => 'jones', 'tom' => 'baker');
foreach($name as $first => $last) {
print "$first $last\n";
}
jim smith
bob jones
tom baker
Thanks!