rsort()
Sorts an array in descending order. In compiled (AOT) code, indexed arrays with runtime-typed (`mixed`) elements are accepted when every element is `null`, `bool`, `int`, `float`, or `string`. A non-scalar element (nested array, object, resource, or boxed callable) terminates execution before sorting with `Fatal error: sorting Mixed arrays containing non-scalar values is not supported`. This deliberate restriction does not implement full PHP container ordering.
rsort()
function rsort(array $array): bool
Sorts an array in descending order. In compiled (AOT) code, indexed arrays with runtime-typed (mixed) elements are accepted when every element is null, bool, int, float, or string. A non-scalar element (nested array, object, resource, or boxed callable) terminates execution before sorting with Fatal error: sorting Mixed arrays containing non-scalar values is not supported. This deliberate restriction does not implement full PHP container ordering.
Parameters:
$array(array), passed by reference
Returns: bool
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/array/rsort.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how rsort is implemented in the compiler, see the internals page.