note 36549 added to function.substr
| From: | dincerakay at yahoo dot com | Date: | Tue, 14 Oct 2003 15:14:36 +0000 |
| Subject: | note 36549 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58580@lists.php.net to get a copy of this message | ||
<?
function Remove($string, $sep1, $sep2)
{
$string = strrev(substr($string, 0, strpos($string, $sep2)));
$string = strrev(substr($string,0,strpos($string, strrev($sep1))));
return $string;
}
echo Remove("123 xyz 8472q abc 392u","xyz","abc");
//Output: 8472q
echo "<hr>";
echo Remove("PHP is a widely-used general-purpose scripting
language","widely","-purpose");
//Output:-used general
?>
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36549
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36549&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36549&report=yes
Search -- http://master.php.net/manage/user-notes.php