note 41518 deleted from function.explode by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 13 Apr 2004 15:27:40 +0000 |
| Subject: | note 41518 deleted from function.explode by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68076@lists.php.net to get a copy of this message | ||
Note Submitter: nico@agora-vita.com
----
a nice way to return a part of a string, situated between two other strings ( can be tags for
example )
function extract($string,$tag1,$tag2)
{
$tab=explode($tag1,$string);
$tab=explode($tag2,$tab[1]);
Return $tab[0];
}
example :
$str="some <start:)>interesting!<end:(> stuff";
echo extract($str,"<start:)>","<end:(>");
will return : interesting !
nico