数组
HaiFengWu1995
这个作者很懒,什么都没留下…
展开
-
PHP实现快速排序
一、先取一个值,用于标准定位。二、遍历数组,将大于值的放到右边数组,小于的放到左边数组三、然后将每次的左右数组和基值一起合并function sort_haifeng($array){ $count = count($array); if ($count<=1) { return $array; } //取最左边的值 $k...原创 2020-03-13 14:36:52 · 109 阅读 · 0 评论 -
PHP冒泡排序
function sort_haifeng($array){ $count = count($array); if ($count<=0) { return false; } for ($i=0; $i <$count ; $i++) { for ($j=0; $j <$count-$i-1 ; $j++) {...原创 2020-03-13 14:29:53 · 88 阅读 · 0 评论 -
PHP数组排序
sort() - 以升序对数组排序rsort() - 以降序对数组排序asort() - 根据值,以升序对关联数组进行排序ksort() - 根据键,以升序对关联数组进行排序arsort() - 根据值,以降序对关联数组进行排序krsort() - 根据键,以降序对关联数组进行排序...原创 2020-03-13 14:27:16 · 85 阅读 · 0 评论