1--TEST-- 2Test array_rand() function : basic functionality - array with default keys 3--FILE-- 4<?php 5/* 6 * Test array_rand() when array with default keys is passed to 'input' argument 7*/ 8 9echo "*** Testing array_rand() : array with default keys ***\n"; 10 11 12// Initialise the 'input' and 'num_req' variables 13$input = array(10, 20, 30, 40, 50, 60, 70); 14$num_req = 6; 15 16// Calling array_rand() with optional argument 17echo"\n-- with all default and optional arguments --\n"; 18var_dump( array_rand($input,$num_req) ); 19 20// Calling array_rand() with default arguments 21echo"\n-- with default argument --\n"; 22var_dump( array_rand($input) ); 23 24echo "Done"; 25?> 26--EXPECTF-- 27*** Testing array_rand() : array with default keys *** 28 29-- with all default and optional arguments -- 30array(%d) { 31 [0]=> 32 int(%d) 33 [1]=> 34 int(%d) 35 [2]=> 36 int(%d) 37 [3]=> 38 int(%d) 39 [4]=> 40 int(%d) 41 [5]=> 42 int(%d) 43} 44 45-- with default argument -- 46int(%d) 47Done 48