PHP数组由于某种原因而更新

Take a look at this code:

$names = array();
$names[] = "abc.com";
$names[] = "def.com";
$names[] = "ghi.com";

$myrecords = array();

foreach ($names as $key => $value) {

    getmxrr($value, $mxrecords);
    $myrecords[$value] = $mxrecords;

}

print "<pre>";
var_dump($myrecords);
print "</pre>";

this code seeks to get the MX records of domains and just print it out. I am making a new array with the domain as key and the value being the retrieved MX records.

The problem is that for some reason, the $mxrecords array is replaced every time so basically the last domain has the mx records and the others show up empty. If i go remove the "ghi.com" domain, then the last domain would be "def.com" and that then suddenly has the mx records showing up.