1--TEST--
2Test array_multisort() function : usage variation - test sort order of all types
3--FILE--
4<?php
5echo "*** Testing array_multisort() : usage variation  - test sort order of all types***\n";
6
7// define some classes
8class classWithToString {
9    public function __toString() {
10        return "Class A object";
11    }
12}
13
14class classWithoutToString { }
15
16$inputs = array(
17      'int 0' => 0,
18      'float -10.5' => -10.5,
19      array(),
20      'uppercase NULL' => NULL,
21      'lowercase true' => true,
22      'empty string DQ' => "",
23      'string DQ' => "string",
24      'instance of classWithToString' => new classWithToString(),
25      'instance of classWithoutToString' => new classWithoutToString(),
26      'undefined var' => @$undefined_var,
27);
28
29var_dump(array_multisort($inputs, SORT_NUMERIC));
30var_dump($inputs);
31
32?>
33--EXPECTF--
34*** Testing array_multisort() : usage variation  - test sort order of all types***
35
36Warning: Object of class classWithToString could not be converted to float in %s on line %d
37
38Warning: Object of class classWithToString could not be converted to float in %s on line %d
39
40Warning: Object of class classWithoutToString could not be converted to float in %s on line %d
41
42Warning: Object of class classWithoutToString could not be converted to float in %s on line %d
43bool(true)
44array(10) {
45  ["float -10.5"]=>
46  float(-10.5)
47  ["int 0"]=>
48  int(0)
49  [0]=>
50  array(0) {
51  }
52  ["uppercase NULL"]=>
53  NULL
54  ["empty string DQ"]=>
55  string(0) ""
56  ["string DQ"]=>
57  string(6) "string"
58  ["undefined var"]=>
59  NULL
60  ["lowercase true"]=>
61  bool(true)
62  ["instance of classWithToString"]=>
63  object(classWithToString)#1 (0) {
64  }
65  ["instance of classWithoutToString"]=>
66  object(classWithoutToString)#2 (0) {
67  }
68}
69