The rsort() function sorts an array by the values in reverse order.
rsort()函数的作用是:对数组的值进行逆向排序。
This function assigns new keys for the elements in the array. Existing keys will be removed.
这个函数为数组中的元素指定了新的键;现存的键将被删除。
This function returns TRUE on success, or FALSE on failure.
如果该函数执行成功将返回True;如果失败将返回False。
rsort(array,sorttype) |
| Parameter 参数 | Description 描述 |
|---|---|
| array | Required. Specifies the array to sort 必要参数。指定一个数组 |
| sorttype | Optional. Specifies how to sort the array values. Possible values: 可选参数。指定对数组值进行分类的方法。下面列举可以使用的参数:
|
<?php$my_array = array("a" => "Dog", "b" => "Cat", "c" => "Horse"); rsort($my_array);print_r($my_array);?> |
The output of the code above will be:
上述代码将输出下面的结果:
Array([0] => Horse[1] => Dog[2] => Cat) |