shuffle

(PHP 3>= 3.0.8, PHP 4 , PHP 5)

shuffle -- Zamieša pole

Popis

bool shuffle ( array pole )

Táto funkcia zamieša (náhodne zmení poradie prvkov) pole.

Príklad 1. Príklad na shuffle()

<?php
$numbers
= range(1, 20);
srand ((float)microtime() * 1000000);
shuffle ($numbers);
while (list (,
$number) = each ($numbers)) {
    echo
"$number ";
}
?>

Poznámka: Po��naj�c PHP 4.2.0 nie je potrebn� �tartova� gener�tor n�hodn�ch ��sel s srand() alebo mt_srand(), nako�ko sa tak u�in� automaticky.

Tiež pozri arsort(), asort(), ksort(), rsort(), sort() a usort().