Getting domain from email address

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Getting domain from email address

Post by evilcoder »

Hey guys, say someone puts there email into a form:

hello@world.com

How would i get PHP to skim the "hello@" off the input so i'm left with just:
world.com ??

thanks
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

Code: Select all

<?php
$email = 'hello@world.com';
$temp = explode('@',$email);
$domain = $temp['1'];
?>
Post Reply