Home
last modified time | relevance | path

Searched refs:array_rand (Results 1 – 17 of 17) sorted by relevance

/php-src/ext/standard/tests/array/
H A Darray_rand.phpt2 array_rand() tests
7 var_dump(array_rand(array()));
13 var_dump(array_rand(array(), 0));
19 var_dump(array_rand(array(1,2,3), 0));
25 var_dump(array_rand(array(1,2,3), -1));
31 var_dump(array_rand(array(1,2,3), 10));
36 var_dump(array_rand(array(1,2,3), 3));
37 var_dump(array_rand(array(1,2,3), 2));
41 array_rand(): Argument #1 ($array) must not be empty
42 array_rand(): Argument #1 ($array) must not be empty
[all …]
H A Darray_rand_variation5.phpt2 Test array_rand() function : usage variation - invalid values for 'req_num' parameter
6 * Test behaviour of array_rand() function when associative array and
11 echo "*** Testing array_rand() : with invalid values for 'req_num' ***\n";
20 // Testing array_rand() function with various invalid 'req_num' values
23 var_dump( array_rand($input) ); // with default $num_req value
25 var_dump( array_rand($input, 1) ); // with valid $num_req value
30 var_dump( array_rand($input, 0) ); // with $num_req=0
37 var_dump( array_rand($input, -1) ); // with $num_req=-1
44 var_dump( array_rand($input, -2) ); // with $num_req=-2
51 var_dump( array_rand($input, 13) ); // with $num_req=13
[all …]
H A Darray_rand_basic1.phpt2 Test array_rand() function : basic functionality - array with default keys
6 * Test array_rand() when array with default keys is passed to 'input' argument
9 echo "*** Testing array_rand() : array with default keys ***\n";
16 // Calling array_rand() with optional argument
18 var_dump( array_rand($input,$num_req) );
20 // Calling array_rand() with default arguments
22 var_dump( array_rand($input) );
27 *** Testing array_rand() : array with default keys ***
H A Darray_rand_basic2.phpt2 Test array_rand() function : basic functionality - with associative array for 'input' argument
6 * Test array_rand() when associative array is passed to 'input' argument
9 echo "*** Testing array_rand() : with associative array ***\n";
21 // Calling array_rand() with optional argument
23 var_dump( array_rand($input,$num_req) );
25 // Calling array_rand() with default arguments
27 var_dump( array_rand($input) );
32 *** Testing array_rand() : with associative array ***
H A Dbug48224.phpt2 Bug #48224 (array_rand no longer shuffles)
6 $a1 = array_rand($a, count($a));
7 $a2 = array_rand($a, count($a));
8 $a3 = array_rand($a, count($a));
9 $a4 = array_rand($a, count($a));
H A Darray_rand_variation3.phpt2 Test array_rand() function : usage variation - with MultiDimensional array
6 * Test behaviour of array_rand() function when multi-dimensional array
10 echo "*** Testing array_rand() : with multi-dimensional array ***\n";
40 // calling array_rand() function with multi-dimensional array
41 var_dump( array_rand($input, $num_req) );
43 // looping to test array_rand() with each sub-array in the multi-dimensional array
44 echo "\n*** Testing array_rand() with arrays having different types of values ***\n";
48 var_dump( array_rand($arr) ); // with default arguments
49 var_dump( array_rand($arr, 3) ); // with default as well as optional arguments
56 *** Testing array_rand() : with multi-dimensional array ***
[all …]
H A Darray_rand_variation6.phpt2 Test array_rand() function : usage variation - with heredoc string as key in the 'input' array
6 * Test behaviour of array_rand() when keys of the 'input' array is heredoc string
9 echo "*** Testing array_rand() : with keys of input array as heredoc strings ***\n";
48 // Test array_rand() function with different valid 'req_num' values
50 var_dump( array_rand($input) );
53 var_dump( array_rand($input, 1) );
56 var_dump( array_rand($input, 3) );
59 var_dump( array_rand($input, 6) );
65 \*\*\* Testing array_rand\(\) : with keys of input array as heredoc strings \*\*\*
H A Dbug74361.phpt2 Bug #74361: Compaction in array_rand() violates COW
7 var_dump(array_rand($array));
H A Darray_rand_variation4.phpt2 Test array_rand() function : usage variation - with associative arrays for 'input' parameter
6 * Test behaviour of array_rand() function when associative array is passed to
10 echo "*** Testing array_rand() : with associative arrays ***\n";
40 /* looping to test array_rand() function with different arrays having
49 var_dump( array_rand($input) );
53 var_dump( array_rand($input, 1) ); // with $num_req=1
55 var_dump( array_rand($input, 2) ); // with $num_req=2
64 \*\*\* Testing array_rand\(\) : with associative arrays \*\*\*
H A Dbug74361_2.phpt2 Bug #74361: Compaction in array_rand() violates COW (variation)
13 array_rand($array, 1);
/php-src/ext/random/tests/03_randomizer/
H A Dcompatibility_array_rand.phpt2 Random: Randomizer: The Mt19937 engine and pickArrayKeys are consistent with array_rand()
14 $mapPickOneFunc = array_rand($map, 1);
15 $mapPickTwoFunc = array_rand($map, 2);
17 $listPickOneFunc = array_rand($list, 1);
18 $listPickTwoFunc = array_rand($list, 2);
/php-src/ext/random/tests/01_functions/
H A Darray_rand_mt_rand_php.phpt2 array_rand() is not affected by MT_RAND_PHP as with PHP < 8.2
15 $key = array_rand($array);
/php-src/sapi/phpdbg/tests/
H A Dgh13681.phpt15 $xconnect=$GLOBALS[array_rand($GLOBALS)];
/php-src/ext/standard/tests/file/
H A Duserstreams.phpt214 $whence = $whence_map[array_rand($whence_map, 1)];
/php-src/ext/standard/
H A Dbasic_functions.stub.php1864 function array_rand(array $array, int $num = 1): int|string|array {} function
H A Dbasic_functions_arginfo.h2378 ZEND_FUNCTION(array_rand);
2971 ZEND_FE(array_rand, arginfo_array_rand)
H A Darray.c6346 PHP_FUNCTION(array_rand) argument

Completed in 43 milliseconds