|
|
PHP Array shuffle() Function
|
Tutorials » Php »
|
Topic |
What is shuffle() Function?
|
|
Explanation |
|
The "shuffle()" function can shuffle an array.
Syntax:
shuffle(array)
In the above syntax "array" is the array to be shuffled, the keys of the array will be completely changed.
Example:
<?php
$b=array("1"=>"Grapes","2"=>"Apple","3" =>"Cherry");
shuffle($b);
print_r($b);
?>
Result:
[0] => Apple
[1] => Cherry
[2] => Grapes
In the above example the array "$b" is shuffled and the keys of the array is completely changed.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|