The shuffle () function sorts the elements in the array in random order.
If yes, TRUE is returned. Otherwise, FALSE is returned.
Note: This function assigns a new key name to the cell in the array. This will delete the original key name, not just the reorder.
Note: Since PHP 4.2.0, the random number generator is no longer needed to be planted using the srand () or mt_srand () function, which has been automatically completed.
<? Php Tutorial
$ My_array = array ("a" => "Dog", "B" => "Cat", "c" => "Horse ");
Shuffle ($ my_array );
Print_r ($ my_array );
?>
The following is a // list of ads stored in arrays.
$ Ads = array ('<a href = "#"> </a>'
, '<A href = "#"> </a>'
, '<A href = "#"> </a>'
, '<A href = "#"> </a>'
);
// Random sorting of arrays
Shuffle ($ ads );
// Output the sorted array
$ Html = '';
Foreach ($ ads as $ ad ){
$ Html. = $ ad;
}
Echo $ html;