标签:int pre col 结果 php echo class sort span
$arrs = [ 1 => ‘苹果‘, 4 => ‘梨子‘, 3 => ‘香蕉‘, 2 => ‘哈密瓜‘ ]; $arrs[0] = ‘草莓‘; print_r($arrs);//结果Array ( [1] => 苹果 [4] => 梨子 [3] => 香蕉 [2] => 哈密瓜 [0] => 草莓 ) echo ‘<br/>‘; ksort($arrs);//按照键排序重新排序, print_r($arrs);//结果Array ( [0] => 草莓 [1] => 苹果 [2] => 哈密瓜 [3] => 香蕉 [4] => 梨子 ) asort($arrs);//按照键值排序重新排序, echo ‘<br/>‘;//结果Array ( [2] => 哈密瓜 [4] => 梨子 [1] => 苹果 [0] => 草莓 [3] => 香蕉 ) print_r($arrs);
标签:int pre col 结果 php echo class sort span
原文地址:https://www.cnblogs.com/fatRabbit-/p/12101241.html