Open
Description
Hello,
during investigation of PHP doc I found interesting thing in array_multisort
function.
For argument rest
there is written:
rest
More arrays, optionally followed by sort order and flags. Only elements corresponding to equivalent elements in previous arrays are compared. In other words, the sort is lexicographical.
Sort order and flags (in this direction), but in example 2 these parameters are switched. Switching should be allowed, but only if flags value is SORT_REGULAR
, but is not this case
<?php
$ar = array(
array("10", 11, 100, 100, "a"),
array( 1, 2, "2", 3, 1)
);
array_multisort($ar[0], SORT_ASC, SORT_STRING,
$ar[1], SORT_NUMERIC, SORT_DESC);
var_dump($ar);
?>
EN DOC: https://www.php.net/manual/en/function.array-multisort.php
Code: https://github.com/php/php-src/blob/5d6bc25063e571da936010b1fae822f5d610deca/ext/standard/array.c#L5630