note 82858 deleted from function.explode by felipe
| From: | felipe@php.net | Date: | Thu, 01 May 2008 03:07:45 +0000 |
| Subject: | note 82858 deleted from function.explode by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138963@lists.php.net to get a copy of this message | ||
Note Submitter: burg3r at draynor dot net
----
Here's a nice function to replace multi-regexp searches:
function multiBetween( $source, $search_for, $inc_start_end = false ) {
# Empty Results Array
$results = array();
# Literate through the array
$arr_index = 0;
foreach( $search_for as $index => $find ) {
$result = explode( $find[1], $source );
$result = explode( $find[0], $result[0] );
$results[$arr_index] = ($inc_start_end) ? $find[0] . $result[1] . $find[1] : $result[1];
$arr_index++;
}
return $results;
}