PHP Function to Return Lowest MX Record

30 09 2010
This is a quick and simple one, but I admittedly started off with a for loop before coming across array_multisort. This turned out to be very useful for an application I'm working on.


// example
echo "Google's lowest MX is:  " . lowestmx("google.com");

function lowestmx($server) {
    getmxrr($server, &$mxhosts, &$weight);
    array_multisort($weight, $mxhosts);
    return $mxhosts[0];
}
 


Trackbacks


No Trackbacks

Comments

Display comments as (Linear | Threaded)
No comments

Add Comment


You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
BBCode format allowed

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA