note 71400 deleted from function.in-array by felipe

From: Date: Sun, 30 Dec 2007 19:00:31 +0000
Subject: note 71400 deleted from function.in-array by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134492@lists.php.net to get a copy of this message
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.

« previous php.notes (#134492) next »