Home >Backend Development >PHP Tutorial >lol re-random PHP reverse sorting and random sorting code
Introduction to array_reverse() function and shuffle() function
array_reverse()
array array_reverse(array)array_reverse() function passes in an array as a parameter and returns an array with the same value as the passed parameter but in the opposite order.
Copy code The code is as follows:
$a = array(1,2,3,4,5);
$a = array_reverse($a);
for ($i =0; $i
?>
Copy code The code is as follows:
$a = array(1,2,3,4,5);
shuffle($a);
for ($i=0; $i
shuffle($a);
echo "
";
for ($i= 0; $i
?>
The above introduces the PHP reverse sorting and random sorting code of lol re-randomization, including the content of lol re-randomization. I hope it will be helpful to friends who are interested in PHP tutorials.