Separation of variable in text

Hello All,
i want to know how i can separate the data from an email that occurs between @ and .
eg shail@gmail.com from here how can i extract gmail.

Thanks
Shail

Google for “php strstr()”

php.net strstr

$email = 'someone@someprovider.com';
if (preg_match('~@(.*?)\.~', $email, $results))
{
    $part = $results[1];
   echo $part; // someprovider
}
else
{
    throw new Exception("Invalid email address '{$email}'");
}

This will return anything up to the first dot after the @. So for example for somedomain.co.uk it will return somedomain, not somedomain.co.

http://php.net/manual/en/function.preg-match.php

Preg match can return data between the @ and .