php通过ksort()函数给关联数组按照键排序,ksort函数按照关联数组的key正序排序,如果要倒序可以是哦那个krsort()函数
$first = array("x"=>5,"a"=>2,"f"=>1); ksort( $first ); foreach ( $first as $key => $val ) { print "$key = $val<br />"; }
php通过ksort()函数给关联数组按照键排序,ksort函数按照关联数组的key正序排序,如果要倒序可以是哦那个krsort()函数
$first = array("x"=>5,"a"=>2,"f"=>1); ksort( $first ); foreach ( $first as $key => $val ) { print "$key = $val<br />"; }