我有两台服务器;一台运行 5.6,另一台运行 7。在两台服务器上使用此函数时,当所有值都相同时,我会得到不同的结果。
<?php
$list = json_decode('{"706":2,"703":2,"702":2,"696":2,"658":2}', true);
print_r($list);
arsort($list);
echo "<br>";
print_r($list);
?>
PHP 5.6 结果
Array ( [706] => 2 [703] => 2 [702] => 2 [696] => 2 [658] => 2 )
Array ( [658] => 2 [696] => 2 [702] => 2 [703] => 2 [706] => 2 )
PHP 7 结果
Array ( [706] => 2 [703] => 2 [702] => 2 [696] => 2 [658] => 2 )
Array ( [706] => 2 [703] => 2 [702] => 2 [696] => 2 [658] => 2 )