note 28358 added to function.strchr
| From: | joaobett at oninet dot pt | Date: | Fri, 10 Jan 2003 14:43:34 +0000 |
| Subject: | note 28358 added to function.strchr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41960@lists.php.net to get a copy of this message | ||
//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 = "@";
$stringA = strrev($stringA); //The first time
$result = strchr($stringA,$toFind);
$result = strrev($result); //The second time
echo $result; //prints user@
//You can use it this way instead:
echo strrev( strchr(strrev($stringA),$toFind) );
-joao
--
http://www.php.net/manual/en/function.strchr.php
http://master.php.net/manage/user-notes.php?action=edit+28358
http://master.php.net/manage/user-notes.php?action=delete+28358
http://master.php.net/manage/user-notes.php?action=reject+28358