http://jp2.php.net/natsort
http://jp2.php.net/natcasesort
<?php $array = ['a1', 'a2', 'a10']; sort($array); print_r($array); /* Array ( [0] => a1 [1] => a10 [2] => a2 ) */ natsort($array); print_r($array); /* Array ( [0] => a1 [2] => a2 [1] => a10 ) */ $array = ['a1' ,'A2', 'a10']; natsort($array); print_r($array); /* Array ( [1] => A2 [0] => a1 [2] => a10 ) */ natcasesort($array); print_r($array); /* Array ( [0] => a1 [1] => A2 [2] => a10 ) */
No comments:
Post a Comment