note 28756 deleted from function.strstr by felipe
| From: | felipe@php.net | Date: | Wed, 16 Apr 2008 11:10:49 +0000 |
| Subject: | note 28756 deleted from function.strstr by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138364@lists.php.net to get a copy of this message | ||
Note Submitter: joaobett at oninet dot pt
----
[Editor's Note: It's better to:
substr($stringA, 0, strpos($stringA, $toFind)+1)
than to reverse the string twice (slow).]
//If you want to get the text before the occurence of the character
//you want to find, simply use the function strRev twice:
$stringA = "user@example.com"; $toFind = "@";
echo strrev( strchr(strrev($stringA),$toFind) );
//output: user@