note 41518 added to function.explode
| From: | nico at agora-vita dot com | Date: | Tue, 13 Apr 2004 12:59:17 +0000 |
| Subject: | note 41518 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68067@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41518
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41518&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41518&report=yes
Search -- http://master.php.net/manage/user-notes.php