1--TEST-- 2Test shuffle() function : error conditions 3--FILE-- 4<?php 5/* Prototype : bool shuffle(array $array_arg) 6 * Description: Randomly shuffle the contents of an array 7 * Source code: ext/standard/array.c 8*/ 9 10/* Test shuffle() to see that warning messages are emitted 11 * when invalid number of arguments are passed to the function 12*/ 13 14echo "*** Testing shuffle() : error conditions ***\n"; 15 16// zero arguments 17echo "\n-- Testing shuffle() function with Zero arguments --\n"; 18var_dump( shuffle() ); 19 20// more than the expected number of arguments 21echo "\n-- Testing shuffle() function with more than expected no. of arguments --\n"; 22$array_arg = array(1, "two" => 2); 23$extra_arg = 10; 24var_dump( shuffle($array_arg, $extra_arg) ); 25 26// printing the input array to check that it is not affected 27// by above shuffle() function calls 28echo "\n-- original input array --\n"; 29var_dump( $array_arg ); 30 31echo "Done"; 32?> 33--EXPECTF-- 34*** Testing shuffle() : error conditions *** 35 36-- Testing shuffle() function with Zero arguments -- 37 38Warning: shuffle() expects exactly 1 parameter, 0 given in %s on line %d 39bool(false) 40 41-- Testing shuffle() function with more than expected no. of arguments -- 42 43Warning: shuffle() expects exactly 1 parameter, 2 given in %s on line %d 44bool(false) 45 46-- original input array -- 47array(2) { 48 [0]=> 49 int(1) 50 ["two"]=> 51 int(2) 52} 53Done 54