note 27989 deleted from function.strstr by felipe
| From: | felipe@php.net | Date: | Wed, 16 Apr 2008 11:10:29 +0000 |
| Subject: | note 27989 deleted from function.strstr by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138362@lists.php.net to get a copy of this message | ||
Note Submitter: nin at screamingslaves dot com
----
Since I managed to do this in a few seconds, why not let it out to someone in the same need ...
Based on the above idea, since I had:
$string = "Some text (some note) some other text";
And say you just wanted whats *between* the parentheses (or between basically anything):
<?
function remover($string, $sep1, $sep2)
{
$string = substr($string, 0, strpos($string,$sep2));
$string = substr(strstr($string, $sep1), 1);
return $string;
}
$string = "Some text (some note) some other text";
$str1 = "(";
$str2 = ")";
echo remover($string, $str1, $str2);
?>