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 error handler
14function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
15	// We're testing sort order not errors so ignore.
16}
17set_error_handler('test_error_handler');
18
19// define some classes
20class classWithToString {
21	public function __toString() {
22		return "Class A object";
23	}
24}
25
26class classWithoutToString { }
27
28$inputs = array(
29      'int 0' => 0,
30      'float -10.5' => -10.5,
31      array(),
32      'uppercase NULL' => NULL,
33      'lowercase true' => true,
34      'empty string DQ' => "",
35      'string DQ' => "string",
36      'instance of classWithToString' => new classWithToString(),
37      'undefined var' => @$undefined_var,
38);
39
40var_dump(array_multisort($inputs, SORT_STRING));
41var_dump($inputs);
42
43?>
44===DONE===
45--EXPECT--
46*** Testing array_multisort() : usage variation  - test sort order of all types***
47bool(true)
48array(9) {
49  ["uppercase NULL"]=>
50  NULL
51  ["empty string DQ"]=>
52  string(0) ""
53  ["undefined var"]=>
54  NULL
55  ["float -10.5"]=>
56  float(-10.5)
57  ["int 0"]=>
58  int(0)
59  ["lowercase true"]=>
60  bool(true)
61  [0]=>
62  array(0) {
63  }
64  ["instance of classWithToString"]=>
65  object(classWithToString)#1 (0) {
66  }
67  ["string DQ"]=>
68  string(6) "string"
69}
70===DONE===
71