Can anyone explain why the following code operates the way it does in my
comments?
<?php
$test = array ( 'a' => 'A', 'b' => 'B', 'c' => 'C');
if (array_key_exists(2, $test)) echo "It works by key number!"; // Does not
work.
if (array_key_exists('c', $test)) echo "It works by key name!"; // Works.
print_r(array_keys($test)); // outputs "Array ( [0] => a [1] => b [2] =>
c ) "
?>
Any ideas? According to the documentation, it seems like I should be able
to access any key in the array by either name or number (which is what I
want to do).
-- Cameron
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php