Home
last modified time | relevance | path

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

/PHP-7.3/ext/standard/tests/array/
H A Darray_rand.phpt2 array_rand() tests
6 var_dump(array_rand());
7 var_dump(array_rand(array()));
8 var_dump(array_rand(array(), 0));
9 var_dump(array_rand(0, 0));
10 var_dump(array_rand(array(1,2,3), 0));
11 var_dump(array_rand(array(1,2,3), -1));
12 var_dump(array_rand(array(1,2,3), 10));
13 var_dump(array_rand(array(1,2,3), 3));
14 var_dump(array_rand(array(1,2,3), 2));
[all …]
H A Darray_rand_error.phpt2 Test array_rand() function : error conditions
5 /* Prototype : mixed array_rand(array input [, int num_req])
10 echo "*** Testing array_rand() : error conditions ***\n";
13 echo "\n-- Testing array_rand() function with Zero arguments --\n";
14 var_dump( array_rand() );
16 //Test array_rand with one more than the expected number of arguments
21 var_dump( array_rand($input,$num_req, $extra_arg) );
26 *** Testing array_rand() : error conditions ***
28 -- Testing array_rand() function with Zero arguments --
30 Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d
[all …]
H A Darray_rand_variation1.phpt2 Test array_rand() function : usage variations - unexpected values for 'input' parameter
5 /* Prototype : mixed array_rand(array input [, int num_req])
15 echo "*** Testing array_rand() : unexpected values for 'input' parameter ***\n";
84 /* loop through each element of the array to test array_rand() function
90 var_dump( array_rand($value,$num_req) );
100 *** Testing array_rand() : unexpected values for 'input' parameter ***
104 Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d
109 Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d
114 Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d
119 Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d
[all …]
H A Darray_rand_variation5.phpt5 /* Prototype : mixed array_rand(array $input [, int $num_req])
11 * Test behaviour of array_rand() function when associative array and
16 echo "*** Testing array_rand() : with invalid values for 'req_num' ***\n";
26 // Testing array_rand() function with various invalid 'req_num' values
29 var_dump( array_rand($input) ); // with default $num_req value
31 var_dump( array_rand($input, 1) ); // with valid $num_req value
35 var_dump( array_rand($input, 0) ); // with $num_req=0
37 var_dump( array_rand($input, -1) ); // with $num_req=-1
39 var_dump( array_rand($input, -2) ); // with $num_req=-2
41 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
5 /* Prototype : mixed array_rand(array $input [, int $num_req])
11 * Test array_rand() when array with default keys is passed to 'input' argument
14 echo "*** Testing array_rand() : array with default keys ***\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() : array with default keys ***
H A Darray_rand_variation2.phpt2 Test array_rand() function : usage variations - unexpected values for 'num_req' parameter
7 /* Prototype : mixed array_rand(array input [, int num_req])
13 * Test array_rand() with different types of values other than int passed to 'num_req' argument
17 echo "*** Testing array_rand() : unexpected values for 'num_req' parameter ***\n";
85 var_dump( array_rand($input,$value) );
92 *** Testing array_rand() : unexpected values for 'num_req' parameter ***
184 Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d
189 Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d
194 Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d
199 Warning: array_rand() expects parameter 2 to be int, string given in %s on line %d
[all …]
H A Darray_rand_basic2.phpt2 Test array_rand() function : basic functionality - with associative array for 'input' argument
5 /* Prototype : mixed array_rand(array $input [, int $num_req])
11 * Test array_rand() when associative array is passed to 'input' argument
14 echo "*** Testing array_rand() : with associative array ***\n";
26 // Calling array_rand() with optional argument
28 var_dump( array_rand($input,$num_req) );
30 // Calling array_rand() with default arguments
32 var_dump( array_rand($input) );
37 *** 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
5 /* Prototype : mixed array_rand(array $input [, int $num_req])
11 * Test behaviour of array_rand() function when multi-dimensional array
15 echo "*** Testing array_rand() : with multi-dimensional array ***\n";
45 // calling array_rand() function with multi-dimensional array
46 var_dump( array_rand($input, $num_req) );
48 // looping to test array_rand() with each sub-array in the multi-dimensional array
53 var_dump( array_rand($arr) ); // with default arguments
54 var_dump( array_rand($arr, 3) ); // with default as well as optional arguments
61 *** 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
5 /* Prototype : mixed array_rand(array $input [, int $num_req])
11 * Test behaviour of array_rand() when keys of the 'input' array is heredoc string
14 echo "*** Testing array_rand() : with keys of input array as heredoc strings ***\n";
53 // Test array_rand() function with different valid 'req_num' values
55 var_dump( array_rand($input) );
58 var_dump( array_rand($input, 1) );
61 var_dump( array_rand($input, 3) );
64 var_dump( array_rand($input, 6) );
70 \*\*\* Testing array_rand\(\) : with keys of input array as heredoc strings \*\*\*
H A Darray_rand_variation4.phpt2 Test array_rand() function : usage variation - with associative arrays for 'input' parameter
5 /* Prototype : mixed array_rand(array $input [, int $num_req])
11 * Test behaviour of array_rand() function when associative array is passed to
15 echo "*** Testing array_rand() : with associative arrays ***\n";
46 /* looping to test array_rand() function with different arrays having
55 var_dump( array_rand($input) );
59 var_dump( array_rand($input, 1) ); // with $num_req=1
61 var_dump( array_rand($input, 2) ); // with $num_req=2
70 \*\*\* Testing array_rand\(\) : with associative arrays \*\*\*
H A Dbug74361.phpt2 Bug #74361: Compaction in array_rand() violates COW
7 var_dump(array_rand($array));
H A Dbug74361_2.phpt2 Bug #74361: Compaction in array_rand() violates COW (variation)
13 array_rand($array, 1);
/PHP-7.3/ext/standard/
H A Dphp_array.h80 PHP_FUNCTION(array_rand);
H A Dbasic_functions.c3382 PHP_FE(array_rand, arginfo_array_rand)
H A Darray.c5772 PHP_FUNCTION(array_rand) argument
/PHP-7.3/ext/standard/tests/file/
H A Duserstreams.phpt211 $whence = $whence_map[array_rand($whence_map, 1)];

Completed in 75 milliseconds