note 58610 deleted from function.substr by cece
| From: | cece@php.net | Date: | Wed, 09 Nov 2005 15:26:25 +0000 |
| Subject: | note 58610 deleted from function.substr by cece | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98336@lists.php.net to get a copy of this message | ||
Note Submitter: luciomonter at libero dot it
Reason: useless
----
As I didn't find it while I was looking for it....
A simple way to extract username from a mail address :
pincopallino@hotmail.com -> pincopallino
function EXTRACT_USERNAME($address)
{
$pos = strpos($address, "@");
if ($pos === false)
{
echo " @ not found in : $address, seems not to be an e-mail address <br/>\n";
}
/*else
{
echo " @ found in $address at column $pos <br/>\n";
}*/
$username = substr("$address", 0, $pos);
return($username);
}
Hope I saved a 10 minutes work to someone !