Introduction to the Array_reverse () function and the shuffle () function
Array_reverse ()
The array array_reverse (array) array_reverse () function passes in an array of arguments, returning an array that is the same as the passed-in parameter value but in the opposite order.
Copy CodeThe code is as follows:
$a = array (1,2,3,4,5);
$a = array_reverse ($a);
for ($i =0; $i echo $a [$i]. " ";
?>
The result is:
5 4 3) 2 1
Shuffle ()
The bool Shuffle (array) Shuffle function randomly sorts the incoming array, returns true successfully, or false.
Copy CodeThe code is as follows:
$a = array (1,2,3,4,5);
Shuffle ($a);
for ($i =0; $i echo $a [$i]. " ";
Shuffle ($a);
echo "
";
for ($i =0; $i echo $a [$i]. " ";
?>
Two calls returned results:
4 1 2 5 3
1 5 2 4 3
http://www.bkjia.com/phpjc/322125.html www.bkjia.com true http://www.bkjia.com/phpjc/322125.html techarticle array_reverse () function and shuffle () function introduction Array_reverse () array Array_ The reverse (array) Array_reverse () function passes in a parameter as an array, returning a value that is the same as the passed-in parameter, but in order ...