PHP Programing language

array_shuffle() Function in PHP
Previous Home Next

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

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: