note 60780 deleted from function.in-array by hholzgra

From: Date: Sun, 06 Aug 2006 11:59:19 +0000
Subject: note 60780 deleted from function.in-array by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115588@lists.php.net to get a copy of this message
Note Submitter: eddie AT eddie punto cl ---- The code in the note below didn't work for me the way i thought it would. I had problems when it enter into the recursive array, if it found the needle it will return true, but the parent in_arrayr would not return true also. so here is my correction to that function <?php function in_arrayr($needle, $haystack) { foreach ($haystack as $value) { if ($needle == $value) return true; elseif (is_array($value)) if (in_arrayr($needle, $value)) return true; } return false; } ?>

« previous php.notes (#115588) next »