note 73172 deleted from function.in-array by danbrown

From: Date: Mon, 08 Jun 2009 21:43:58 +0000
Subject: note 73172 deleted from function.in-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156511@lists.php.net to get a copy of this message
Note Submitter: mike at php-webdesign dot nl ---- @vandor at ahimsa dot hu Why first check normal and then strict, make it more dynamically?? <?php function in_arrayr($needle, $haystack, strict = false) { if($strict === false){ foreach ($haystack as $v) { if ($needle == $v) return true; elseif (is_array($v)) if (in_arrayr($needle, $v) == true) return true; } return false; } else { foreach ($haystack as $v) { if ($needle === $v) return true; elseif (is_array($v)) if (in_arrayr($needle, $v) === true) return true; } return false; } ?>

« previous php.notes (#156511) next »