PHP Programing language

adplus-dvertising
array_shuffle() Function in PHP
Previous Home Next
adplus-dvertising

array_shuffle()

The shuffle() function make random in order of arrangement of the elements in the array.

Syntax:
shuffle(array)

In above syntax, "array" specifies the array to use.

Example:

<?php
$my_array = array("Apple","Mango","Banana","Orange","Papaya");
shuffle($my_array);
print_r($my_array);
?>

Output:

Array ( [0] => Banana [1] => Orange [2] => Mango [3] => Apple [4] => Papaya )
Now refersh the output page to see the result of shuffle() function.

Previous Home Next