php通过asort()给关联数组按照值排序,和sort的区别是,sort为数组中的单元赋予新的键名。原有的键名将被删除。
$nums = array("one"=>5,"two"=>2,"three"=>1); asort( $nums ); foreach ( $nums as $key => $val ) { print "$key = $val"; }
上一篇:怎么在php中sort()函数对数组进行排序
下一篇:怎么在PHP中实现一个alert() 提示框