PHP将数组按大小排序的方法
PHP将数组按大小排序的方法
可以通过如下函数进行排序
- sort() 升序,从小到大
- rsort() 降序,从大到小
sort() 升序,从小到大
<?php $numbers=array(3,5,1,22,11); sort($numbers); ?> //输出 1 3 5 11 22
rsort() 降序,从大到小
<?php $numbers=array(3,5,1,22,11); rsort($numbers); ?> //输出 22 11 5 3 1
本文标题: PHP将数组按大小排序的方法
本文链接: https://crm.yallacn.com/jiaocheng/940.html (转载时请注明来源链接)
本文说明: 有问题或投稿请发送至: 邮箱/service@zhimatong.com QQ/1174742835
特别鸣谢: 如果您觉得本文对您有帮助,请给我们一个小小的赞,收藏本文更利于反复学习哦!
热门主题
相关阅读
- 详解layui使用table的sort排序方法
- PHP常用的获取网页html内容的6种方法
- layui触发排序切换,如何实现全局排序
- ThinkPHP使用update函数更新数据的方法
- PHP 将数组打乱 shuffle 函数
- PHP 数组排序 sort、asort 及 ksort 系列函数
- PHP 字符串去除 trim、ltrim 与 rtrim 函数
- PHP 字符串存储(转义) addslashes 与 stripslashes 函数
- PHP 字符串 XHTML格式化显示 nl2br 与 htmlspecialchars 函数
- layui 表格sort排序时,序号不打乱
- PHP array_filter()函数:过滤数组中的(空)值
- PHP 字符串获取 substr 与 strstr 函数



交流群
购物车