Thread: in_array oddity
View Single Post

  #1 (permalink)  
Old 10-12-2004
Tom Barnes
 
Posts: n/a
Default in_array oddity

Check out this code:

// Start Code -------------
function test_in_array($val)
{
$a = array('key' => $val);
printf("in_array: %d, value:%s<BR>", in_array('key', $a), $a['key']);
}
test_in_array(0);
test_in_array(1);
// End Code ---------------

The output I get is:

in_array: 1, value:0
in_array: 0, value:1

Why does the second in_array() call fail???
Reply With Quote