import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / array_multisort_variation1.php
blob3456ed52d30ab899f8df1b5be4c4c30e34ce081a
1 <?php
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
5 * Alias to functions:
6 */
8 echo "*** Testing array_multisort() : usage variation ***\n";
10 // Define error handler
11 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
12 if (error_reporting() != 0) {
13 // report non-silenced errors
14 echo "Error: $err_no - $err_msg, $filename($linenum)\n";
17 set_error_handler('test_error_handler');
19 $ar2 = array(1, 2);
21 //get an unset variable
22 $unset_var = 10;
23 unset ($unset_var);
25 // define some classes
26 class classWithToString
28 public function __toString() {
29 return "Class A object";
33 class classWithoutToString
37 // heredoc string
38 $heredoc = <<<EOT
39 hello world
40 EOT;
42 // add arrays
43 $index_array = array (1, 2, 3);
44 $assoc_array = array ('one' => 1, 'two' => 2);
46 //array of values to iterate over
47 $inputs = array(
49 // int data
50 'int 0' => 0,
51 'int 1' => 1,
52 'int 12345' => 12345,
53 'int -12345' => -2345,
55 // float data
56 'float 10.5' => 10.5,
57 'float -10.5' => -10.5,
58 'float 12.3456789000e10' => 12.3456789000e10,
59 'float -12.3456789000e10' => -12.3456789000e10,
60 'float .5' => .5,
62 // null data
63 'uppercase NULL' => NULL,
64 'lowercase null' => null,
66 // boolean data
67 'lowercase true' => true,
68 'lowercase false' =>false,
69 'uppercase TRUE' =>TRUE,
70 'uppercase FALSE' =>FALSE,
72 // empty data
73 'empty string DQ' => "",
74 'empty string SQ' => '',
76 // string data
77 'string DQ' => "string",
78 'string SQ' => 'string',
79 'mixed case string' => "sTrInG",
80 'heredoc' => $heredoc,
82 // object data
83 'instance of classWithToString' => new classWithToString(),
84 'instance of classWithoutToString' => new classWithoutToString(),
86 // undefined data
87 'undefined var' => @$undefined_var,
89 // unset data
90 'unset var' => @$unset_var,
93 // loop through each element of the array for ar1
95 foreach($inputs as $key =>$value) {
96 echo "\n--$key--\n";
97 var_dump( array_multisort($value));
101 ===DONE===