In
Shuffle--The array is scrambled:
BOOL Shuffle (array &array)
php function Shuffle () An array of scrambled (randomly arranged cells).
Note: The PHP function shuffle () assigns a new key name to the cells in the array. This will delete the original key name and not just reorder it.
Example:
- < ? PHP
- $ a = Array (
- ' 1 ' = > ' Xiao ',
- ' 2 ' = > ' Da ',
- ' 3 ' = > ' Zuo ',
- ' 4 ' = > ' You '
- );
- echo "original array:". " < br />";
- Print_r ($a);
- Shuffle ($a);
- echo " < br />"." Now the array: "." < br />";
- Print_r ($a);
- ?>
Look at the results of the PHP function shuffle ():
The original array:
Array ([1] = Xiao [2] = Da [3] = Zuo [4] = =--)
Now the array:
Array ([0] = Da [1] = Xiao [2] = = [3] = = Zuo)
Of course, each time the page is refreshed, the order of the elements in the "now array" is changed once. Note that the key name of the array has changed.
http://www.bkjia.com/PHPjc/446075.html www.bkjia.com true http://www.bkjia.com/PHPjc/446075.html techarticle in Shuffle--the array is scrambled: the bool Shuffle (array array) PHP function shuffle () disrupts (randomly arranges the order of the cells) an array. Note: The PHP function Shuffle () is a unit in the array ...