参数 | 描述 |
---|---|
array | 必需。规定要进行排序的数组。 |
提示:natcasesort() 是 natsort() 函数 的不区分大小写字母的版本。
<?php $temp_files = array("temp15.txt","Temp10.txt", "temp1.txt","Temp22.txt","temp2.txt"); natsort($temp_files); echo "Natural order: "; print_r($temp_files); echo "<br />"; natcasesort($temp_files); echo "Natural order case insensitve: "; print_r($temp_files); ?>
输出:
Natural order: Array ( [0] => Temp10.txt [1] => Temp22.txt [2] => temp1.txt [4] => temp2.txt [3] => temp15.txt ) Natural order case insensitve: Array ( [2] => temp1.txt [4] => temp2.txt [0] => Temp10.txt [3] => temp15.txt [1] => Temp22.txt )
制作:
http://www.7di.net 生活网搜集整理 参考: http://www.w3school.com.cn/php/func_array_natcasesort.asp |