note 39007 added to function.in-array

From: Date: Wed, 14 Jan 2004 14:08:15 +0000
Subject: note 39007 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-63528@lists.php.net to get a copy of this message
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; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39007 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39007&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39007&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63528) next »