note 39007 deleted from function.in-array by felipe

From: Date: Sun, 30 Dec 2007 18:52:31 +0000
Subject: note 39007 deleted from function.in-array by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134471@lists.php.net to get a copy of this message
Note Submitter: Frank Sträter ---- I forgot ta add $value === $needle instead of $value == $needle. The first one does a strict check. Thanks to the note by michi I have reduced the function to: <?php function in_array_multi($needle, $haystack) { if (!is_array($haystack)) return false; while (list($key, $value) = each($haystack)) { if (is_array($value) && in_array_multi($needle, $value) || $value === $needle) { return true; } } return false; } ?>

« previous php.notes (#134471) next »