email validation

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
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

email validation

Post by SidewinderX »

I found this nice documentation on the Zend site [ http://www.zend.com/zend/spotlight/ev12apr.php ], but if you scroll a little more than halfway down [step three] there is this code:

Code: Select all

list ( $Username, $Domain ) = split ("@",$Email);

   if (getmxrr($Domain, $MXHost))  {

        $ConnectAddress = $MXHost[0];
    } else {

        $ConnectAddress = $Domain;

    }
Where does $MXHost come from?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

http://uk3.php.net/function.getmxrr

Anywhere in the documentation where you see &$something in the synopsis, if you pass a variable which doesn't already exist PHP will create it for you. If you pass one that does exist, PHP will modify it. This is called passing by-reference.

In this case, getmxrr() creates the variable (an array). It's putting MX hostnames into it.
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

I never knew that. Thank you.
Post Reply