note 100271 deleted from function.in-array by danbrown
| From: | danbrown@php.net | Date: | Tue, 05 Oct 2010 15:46:16 +0000 |
| Subject: | note 100271 deleted from function.in-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172977@lists.php.net to get a copy of this message | ||
Note Submitter: tudz_h at yahoo dot com
----
the 14-Jan-2006 05:44 post ( recursive in_array ) doesn't work
I added some stuff to make it work:
function in_arrayr( $needle, $haystack )
{
$bReturn = false;;
foreach ( $haystack as $v )
{
if ( $needle == $v ) $bReturn = true;
elseif ( is_array( $v ) ) $bReturn = in_arrayr( $needle, $v );
if ( $bReturn )
return $bReturn;
}
return false;
}