2 /* Prototype : bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]], ...])
3 * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
4 * Source code: ext/standard/array.c
9 class classWithToString
{
10 public function __toString() {
11 return "Class A object";
15 class classWithoutToString
{ }
17 // Define error handler
18 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
19 // We're testing sort order not errors so ignore.
21 <<__EntryPoint
>> function main(): void
{
22 echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n";
24 set_error_handler(fun('test_error_handler'));
28 'float -10.5' => -10.5,
30 'uppercase NULL' => NULL,
31 'lowercase true' => true,
32 'empty string DQ' => "",
33 'string DQ' => "string",
34 'instance of classWithToString' => new classWithToString(),
35 'instance of classWithoutToString' => new classWithoutToString(),
36 'undefined var' => @$undefined_var,
39 $string = SORT_STRING
;
40 var_dump(array_multisort2(inout
$inputs, inout
$string));