note 71746 added to function.array-search
| From: | otto at twbc dot net | Date: | Thu, 14 Dec 2006 07:06:37 +0000 |
| Subject: | note 71746 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120596@lists.php.net to get a copy of this message | ||
Unlimited depth array regular expression search, I found it useful, perhaps someone else will too.
Searches on the array values only. Key search could be easily added.
function Array_Search_Preg( $find, $in_array, $keys_found=Array() )
{
if( is_array( $in_array ) )
{
foreach( $in_array as $key=> $val )
{
if( is_array( $val ) ) $this->Array_Search_Preg( $find, $val, $keys_found );
else
{
if( preg_match( '/'. $find .'/', $val ) ) $keys_found[] = $key;
}
}
return $keys_found;
}
return false;
}
----
Server IP: 203.220.0.234
Probable Submitter: 203.145.52.3
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/71746
Del: integrated -- https://master.php.net/note/delete/71746/integrated
Del: useless -- https://master.php.net/note/delete/71746/useless
Del: bad code -- https://master.php.net/note/delete/71746/bad+code
Del: spam -- https://master.php.net/note/delete/71746/spam
Del: non-english -- https://master.php.net/note/delete/71746/non-english
Del: in docs -- https://master.php.net/note/delete/71746/in+docs
Del: other reasons-- https://master.php.net/note/delete/71746
Reject -- https://master.php.net/note/reject/71746
Search -- https://master.php.net/manage/user-notes.php