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 error handler 8function test_error_handler($err_no, $err_msg, $filename, $linenum) { 9 // We're testing sort order not errors so ignore. 10} 11set_error_handler('test_error_handler'); 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 'undefined var' => @$undefined_var, 32); 33 34var_dump(array_multisort($inputs, SORT_STRING)); 35var_dump($inputs); 36 37?> 38--EXPECT-- 39*** Testing array_multisort() : usage variation - test sort order of all types*** 40bool(true) 41array(9) { 42 ["uppercase NULL"]=> 43 NULL 44 ["empty string DQ"]=> 45 string(0) "" 46 ["undefined var"]=> 47 NULL 48 ["float -10.5"]=> 49 float(-10.5) 50 ["int 0"]=> 51 int(0) 52 ["lowercase true"]=> 53 bool(true) 54 [0]=> 55 array(0) { 56 } 57 ["instance of classWithToString"]=> 58 object(classWithToString)#1 (0) { 59 } 60 ["string DQ"]=> 61 string(6) "string" 62} 63