note 61345 deleted from function.preg-match-all by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 01:59:24 +0000 |
| Subject: | note 61345 deleted from function.preg-match-all by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133083@lists.php.net to get a copy of this message | ||
Note Submitter: egingell at sisna dot com
----
Try this for preg_match_all that takes an array of reg expers.
<?
// Emulates preg_match_all() but takes an array instead of a string.
// Returns an array containing all of the matches.
// The return array is an array containing the arrays normally returned by
// preg_match_all() with the optional third parameter supplied.
function preg_search($ary, $subj) {
$matched = array();
if (is_array($ary)) {
foreach ($ary as $v) {
preg_match_all($v, $subj, $matched[]);
}
} else {
preg_match_all($ary, $subj, $matched[]);
}
return $matched;
}
?>