array_reverse() Reverse sorting function
The 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.
$a = array(1,2,3,4,5);
$a = array_reverse($a);
for ($i=0; $i< ;count($a); $i)
echo $a[$i]." ";
?>
The result is:
5 4 3 2 1
shuffle() Random sorting code function
The function randomly sorts the incoming array and returns TRUE if successful, otherwise it returns FALSE.
$a = array(1,2,3,4,5);
shuffle($a);
for ($i=0; $i
shuffle($a);
echo "
";
for ($i =0; $i
?>
The result returned by two calls:
4 1 2 5 3
1 5 2 4 3