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.
1 2 3 4 5 6 7 8 |
// example echo "Google's lowest MX is: " . lowestmx("google.com"); function lowestmx($server) { getmxrr($server, &$mxhosts, &$weight); array_multisort($weight, $mxhosts); return $mxhosts[0]; } |
Leave a Reply