1--TEST-- 2Test rsort() function : error conditions - Pass incorrect number of args 3--FILE-- 4<?php 5/* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) 6 * Description: Sort an array in reverse order 7 * Source code: ext/standard/array.c 8 */ 9 10/* 11 * Pass incorrect number of arguments to rsort() to test behaviour 12 */ 13 14echo "*** Testing rsort() : error conditions ***\n"; 15 16// zero arguments 17echo "\n-- Testing rsort() function with Zero arguments --\n"; 18var_dump( rsort() ); 19 20//Test rsort() with more than the expected number of arguments 21echo "\n-- Testing rsort() function with more than expected no. of arguments --\n"; 22$array_arg = array(1, 2); 23$sort_flags = SORT_REGULAR; 24$extra_arg = 10; 25var_dump( rsort($array_arg, $sort_flags, $extra_arg) ); 26 27// dump the input array to ensure that it wasn't changed 28var_dump($array_arg); 29 30echo "Done"; 31?> 32--EXPECTF-- 33*** Testing rsort() : error conditions *** 34 35-- Testing rsort() function with Zero arguments -- 36 37Warning: rsort() expects at least 1 parameter, 0 given in %s on line %d 38bool(false) 39 40-- Testing rsort() function with more than expected no. of arguments -- 41 42Warning: rsort() expects at most 2 parameters, 3 given in %s on line %d 43bool(false) 44array(2) { 45 [0]=> 46 int(1) 47 [1]=> 48 int(2) 49} 50Done 51