note 39485 rejected from function.preg-grep by didou
| From: | didou@php.net | Date: | Fri, 30 Jan 2004 10:27:19 +0000 |
| Subject: | note 39485 rejected from function.preg-grep by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64423@lists.php.net to get a copy of this message | ||
Note Submitter: radu_and at netex.ro
----
It will be helpfull for preg_grep also to catch the strings between pattern paranthesis .
For this I wrote a simple function called preg_grep_all.
Every element of the returned array is an array of preg_match function:
function preg_grep_all($pattern,$array,$reindex=""){
foreach ($array as $key=>$value){
if (preg_match($pattern,$value,$regs)) $tt[$key]=$regs;
}// end foreach
if($reindex) $tt=array_values($tt);
return $tt;
}// end function