note 71400 deleted from function.in-array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: lafo 

----

The specification of this function is misleading.

<?php
$os = array("mac"=>"Mac", "NT", "Irix", "Linux");
if (in_array("mac", $os)) {
   echo "Got mac";
}
// prints Got mac !!!
?>

in_array searches both values AND indexes IF it is not running in the strict mode!

Correct specification: Checks if a value or a key exists in an array. In the strict mode, checks if a value exists in an array.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.