Definition and usage
The shuffle () function rearranges the elements in the array in random order.
Returns TRUE if successful, otherwise FALSE is returned.
Note: This function assigns the new key name to the cells in the array. This will delete the original key name and not just reorder it.
Note: since PHP 4.2.0, it is no longer necessary to sow the random number generator with the Srand () or Mt_srand () function, which is now automatically completed.
Grammar
Shuffle (Array)
Parameters |
Description |
Array |
Necessary. Specifies the array to use. |
Example
!--? Php$my_array = Array (" A "=-->" Dog "," b "=" Cat "," c "=" Horse "); SHUFFL E ($my _array);p rint_r ($my _array);?
Output:
array ([0] = Cat [1] = Horse [2] = Dog)
Above Introduced the PHP shuffle function, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.