note 97465 added to function.in-array
| From: | bogdanATbogdanconstantinescuDOTcom at osu1 dot php dot net | Date: | Wed, 21 Apr 2010 15:01:32 +0000 |
| Subject: | note 97465 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168475@lists.php.net to get a copy of this message | ||
If you found yourself in need of a multidimensional array in_array like function you can use the one
below. Works in a fair amount of time
<?php
function in_multiarray($elem, $array)
{
$top = sizeof($array) - 1;
$bottom = 0;
while($bottom <= $top)
{
if($array[$bottom] == $elem)
return true;
else
if(is_array($array[$bottom]))
if(in_multiarray($elem, ($array[$bottom])))
return true;
$bottom++;
}
return false;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 93.115.170.10
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/97465
Del: integrated -- https://master.php.net/note/delete/97465/integrated
Del: useless -- https://master.php.net/note/delete/97465/useless
Del: bad code -- https://master.php.net/note/delete/97465/bad+code
Del: spam -- https://master.php.net/note/delete/97465/spam
Del: non-english -- https://master.php.net/note/delete/97465/non-english
Del: in docs -- https://master.php.net/note/delete/97465/in+docs
Del: other reasons-- https://master.php.net/note/delete/97465
Reject -- https://master.php.net/note/reject/97465
Search -- https://master.php.net/manage/user-notes.php