note 45516 added to function.in-array

From: Date: Thu, 09 Sep 2004 14:49:12 +0000
Subject: note 45516 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-76328@lists.php.net to get a copy of this message
Here is a function to search a string in multidimensional Arrays(you can have so much dimensions as you like: function in_array_multi($needle, $haystack) { $found = false; foreach($haystack as $value) if((is_array($value) && in_array_multi($needle, $value)) || $value == $needle) $found = true; return $found; } It is a little shorter than the other function. ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45516 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45516&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45516&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76328) next »