1--TEST--
2Test array_multisort() function : usage variation - test sort order of all types
3--FILE--
4<?php
5/* 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]], ...])
6 * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
7 * Source code: ext/standard/array.c
8 * Alias to functions:
9 */
10
11echo "*** Testing array_multisort() : usage variation  - test sort order of all types***\n";
12
13// define some classes
14class classWithToString {
15	public function __toString() {
16		return "Class A object";
17	}
18}
19
20class classWithoutToString { }
21
22$inputs = array(
23      'int 0' => 0,
24      'float -10.5' => -10.5,
25      array(),
26      'uppercase NULL' => NULL,
27      'lowercase true' => true,
28      'empty string DQ' => "",
29      'string DQ' => "string",
30      'instance of classWithToString' => new classWithToString(),
31      'instance of classWithoutToString' => new classWithoutToString(),
32      'undefined var' => @$undefined_var,
33);
34
35var_dump(array_multisort($inputs));
36var_dump($inputs);
37
38?>
39===DONE===
40--EXPECT--
41*** Testing array_multisort() : usage variation  - test sort order of all types***
42bool(true)
43array(10) {
44  ["float -10.5"]=>
45  float(-10.5)
46  ["int 0"]=>
47  int(0)
48  [0]=>
49  array(0) {
50  }
51  ["uppercase NULL"]=>
52  NULL
53  ["empty string DQ"]=>
54  string(0) ""
55  ["undefined var"]=>
56  NULL
57  ["lowercase true"]=>
58  bool(true)
59  ["instance of classWithToString"]=>
60  object(classWithToString)#1 (0) {
61  }
62  ["string DQ"]=>
63  string(6) "string"
64  ["instance of classWithoutToString"]=>
65  object(classWithoutToString)#2 (0) {
66  }
67}
68===DONE===
69