If you need to extract the username from an e-mail address string then this snippet can help you. For instance, you can use this function inside a loop, while selecting emails from a database.
<?php
function getUsernameFromEmail($email)
{
$find = '@';
$pos = strpos($email, $find);
$username = substr($email, 0, $pos);
return $username;
}
$email = '[email protected]';
$username = getUsernameFromEmail($email);
echo $username; // thecoder
?>