1--TEST-- 2Test array_multisort() function : basic functionality 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() : basic functionality ***\n"; 12 13// Initialise all required variables 14$ar1 = array("row1" => 2, "row2" => 1, "row3" => 1); 15$ar2 = array("row1" => 2, "row2" => "aa", "row3" => "1"); 16 17echo "\n-- Testing array_multisort() function with all normal arguments --\n"; 18var_dump( array_multisort($ar1, SORT_ASC, SORT_REGULAR, $ar2, SORT_DESC, SORT_STRING) ); 19var_dump($ar1, $ar2); 20 21echo "\n-- Testing array_multisort() function with one argument --\n"; 22var_dump( array_multisort($ar2) ); 23var_dump($ar2); 24 25 26?> 27===DONE=== 28--EXPECTF-- 29*** Testing array_multisort() : basic functionality *** 30 31-- Testing array_multisort() function with all normal arguments -- 32bool(true) 33array(3) { 34 ["row2"]=> 35 int(1) 36 ["row3"]=> 37 int(1) 38 ["row1"]=> 39 int(2) 40} 41array(3) { 42 ["row2"]=> 43 string(2) "aa" 44 ["row3"]=> 45 string(1) "1" 46 ["row1"]=> 47 int(2) 48} 49 50-- Testing array_multisort() function with one argument -- 51bool(true) 52array(3) { 53 ["row3"]=> 54 string(1) "1" 55 ["row2"]=> 56 string(2) "aa" 57 ["row1"]=> 58 int(2) 59} 60===DONE===