????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.135.204.121 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/array/ |
Upload File : |
--TEST-- Test array_rand() function : usage variation - invalid values for 'req_num' parameter --FILE-- <?php /* Prototype : mixed array_rand(array $input [, int $num_req]) * Description: Return key/keys for random entry/entries in the array * Source code: ext/standard/array.c */ /* * Test behaviour of array_rand() function when associative array and * various invalid values are passed to the 'input' and 'req_num' * parameters respectively */ echo "*** Testing array_rand() : with invalid values for 'req_num' ***\n"; // initialise associative arrays $input = array( 1 => 'one', 2.2 => 'float key', 0.9 => 'decimal key', 2e2 => 'exp key1', 2000e-3 => 'negative exp key', 0xabc => 2748, 0x12f => '303', 0xff => "255", 0123 => 83, 0129 => 10, 010 => "8" ); // Testing array_rand() function with various invalid 'req_num' values // with valid num_req values echo"\n-- With default num_req value --\n"; var_dump( array_rand($input) ); // with default $num_req value echo"\n-- With num_req = 1 --\n"; var_dump( array_rand($input, 1) ); // with valid $num_req value // with invalid num_req value echo"\n-- With num_req = 0 --\n"; var_dump( array_rand($input, 0) ); // with $num_req=0 echo"\n-- With num_req = -1 --\n"; var_dump( array_rand($input, -1) ); // with $num_req=-1 echo"\n-- With num_req = -2 --\n"; var_dump( array_rand($input, -2) ); // with $num_req=-2 echo"\n-- With num_req more than number of members in 'input' array --\n"; var_dump( array_rand($input, 13) ); // with $num_req=13 echo "Done"; ?> --EXPECTF-- *** Testing array_rand() : with invalid values for 'req_num' *** -- With default num_req value -- int(%d) -- With num_req = 1 -- int(%d) -- With num_req = 0 -- Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d NULL -- With num_req = -1 -- Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d NULL -- With num_req = -2 -- Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d NULL -- With num_req more than number of members in 'input' array -- Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d NULL Done