I have the following code:
<pre>
<?php
$array['page'] = 'page';
$array['article'] = 0;
$array['other'] = 1;
var_dump($array);
$index0 = array_search(0, $array);
var_dump($index0);
$index1 = array_search(1, $array);
var_dump($index1);
?>
</pre>
With the following output:
array(3) {
["page"]=>
string(4) "page"
["article"]=>
int(0)
["other"]=>
int(1)
}
string(4) "page"
string(5) "other"
As you see in the 'article'
index of the array I have the value 0 (0 as a integer value), so I expect to have in the $index0
var the value 'article'
but I obtain the value 'page'
, the first item in the array ($array[0]
).
But if I try to obtain the index for the value 1 (1 as a integer value), the $index1
variable have the good value 'other'
.
This is normal?