PHP rsort() 函数
PHP 教程
· 2019-01-22 22:29:15
实例
对数组 $cars 中的元素按字母进行降序排序:
<?php
$cars=array("Volvo","BMW","Toyota");
rsort($cars);
?>
$cars=array("Volvo","BMW","Toyota");
rsort($cars);
?>
定义和用法
rsort() 函数对数值数组进行降序排序。
提示:请使用 sort() 函数对数值数组进行升序排序。
语法
rsort(array,sortingtype);
| 参数 | 描述 |
|---|---|
| array | 必需。规定要进行排序的数组。 |
| sortingtype | 可选。规定如何排列数组的元素/项目。可能的值:
|
技术细节
| 返回值: | 如果成功则返回 TRUE,如果失败则返回 FALSE。 |
|---|---|
| PHP 版本: | 4+ |
更多实例
实例 1
对数组 $numbers 中的元素按数字进行降序排序:
<?php
$numbers=array(4,6,2,22,11);
rsort($numbers);
?>
$numbers=array(4,6,2,22,11);
rsort($numbers);
?>
实例 2
把每一项作为数字来处理,并对数组 $cars 中的元素进行降序排序:
<?php
$cars=array("Volvo","BMW","Toyota");
rsort($cars,SORT_NUMERIC);
?>
$cars=array("Volvo","BMW","Toyota");
rsort($cars,SORT_NUMERIC);
?>
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
Big Java Late Objects
Horstmann, Cay S. / 2012-2 / 896.00元
The introductory programming course is difficult. Many students fail to succeed or have trouble in the course because they don't understand the material and do not practice programming sufficiently. ......一起来看看 《Big Java Late Objects》 这本书的介绍吧!
URL 编码/解码
URL 编码/解码
RGB HSV 转换
RGB HSV 互转工具