Page 1 of 1

email validation

Posted: Sat Aug 11, 2007 7:47 pm
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?

Posted: Sat Aug 11, 2007 8:17 pm
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.

Posted: Sat Aug 11, 2007 10:01 pm
by SidewinderX
I never knew that. Thank you.