note 77751 added to function.getmxrr

From: Date: Tue, 11 Sep 2007 23:10:29 +0000
Subject: note 77751 added to function.getmxrr
Groups: php.notes 
Request: Send a blank email to php-notes+get-130386@lists.php.net to get a copy of this message
As stated, some of the code listed below will have trouble with multiple equal weights, such as if you query gmail.com. The following code will prevent that by switching the key/values. <?php // Get the records getmxrr("gmail.com", $mx_records, $mx_weight); // Put the records together in a array we can sort for($i=0;$i<count($mx_records);$i++){ $mxs[$mx_records[$i]] = $mx_weight[$i]; } // Sort them asort ($mxs); // Since the keys actually hold the data we want, just put those in an array, called records $records = array_keys($mxs); // Simply echoes all the stuff in the records array for($i = 0; $i < count($records); $i++){ echo $records[$i]; echo '<br>'; } ?> If you wanted to get the weight, you would use "array_values($mxs);" instead of "array_keys($mxs);". Hope this helps some people. ---- Server IP: 208.69.120.35 Probable Submitter: 12.219.121.229 ---- Manual Page -- http://www.php.net/manual/en/function.getmxrr.php Edit -- https://master.php.net/note/edit/77751 Del: integrated -- https://master.php.net/note/delete/77751/integrated Del: useless -- https://master.php.net/note/delete/77751/useless Del: bad code -- https://master.php.net/note/delete/77751/bad+code Del: spam -- https://master.php.net/note/delete/77751/spam Del: non-english -- https://master.php.net/note/delete/77751/non-english Del: in docs -- https://master.php.net/note/delete/77751/in+docs Del: other reasons-- https://master.php.net/note/delete/77751 Reject -- https://master.php.net/note/reject/77751 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130386) next »