How to Extract domain name from email

This tutorial extract domain name from email account. you can use many way to achieve this below is simple step to get extract domain name.

$email='domainextract@gmail.com';

$domain = substr(strrchr($email, "@"), 1);

Other way

$domain = array_pop(explode('@', $email));

Leave a Reply