//一个对数组进行从大小排序的函数
function sort_array($arr)
{
$tmp = $arr;
$return = array();
$cnt = 0;
if (!is_array($arr))
{
return false;
}
foreach ($arr as $k => $v)
{
$max = 10000000000;
foreach ($tmp as $kk => $vv)
{
if ($max > $vv)
{
$max = $vv;
$key = $kk;
}
++$cnt;
}
$return[$key] = $max;
unset($tmp[$key]);
}
echo '执行' . $cnt , '次';
return $return;
}
/*
array_s
*/
$aa = array(
2, 54, 3, 43, 77, 99
);
$bb = sort_array($aa);
array_reverse($bb);
dump($bb);