英[???fl] 美[???f?l]

vt.Shuffle; shuffle; move; put aside, put aside

vi.shirk; shuffle; jump shuffle Dance; move

n.Shuffle, chaos, confusion; dragging feet

Third person singular: shuffles Plural: shuffles Present participle: shuffling Past tense: shuffled Past participle: shuffled

php shuffle() function syntax

Function: Reorder the elements in the array in random order:

Syntax: shuffle(array)

Parameters:

ParametersDescription
arrayRequired . Specifies the array to use.

Description: Returns TRUE if successful, returns FALSE if failed.

php shuffle() function example

<?php
$a = array("class" => "php中文網(wǎng)","name" => "西門","job" => "講師");
shuffle($a);
print_r($a);
?>

Run instance?

Click the "Run instance" button to view the online instance

Output:

Array ( [0] => 西門 [1] => php中文網(wǎng) [2] => 講師 )
<?php
$my_array = array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow","e"=>"purple");

shuffle($my_array);
print_r($my_array);
?>

Run Instance?

Click the "Run Instance" button to view the online instance

Output:

Array ( [0] => yellow [1] => green [2] => red [3] => purple [4] => blue )