Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

shuffle

Description

The shuffle of Array for PHP shuffles an array.

Syntax

shuffle(
    array &$array
): true

Parameters

array

The array.

Return

Always returns true.

Examples

1 · array

<?

$array = range(1, 20);

shuffle($array);

print_r($array);

?>
Array
(
    [0] => 5
    [1] => 19
    [2] => 3
    [3] => 2
    [4] => 6
    [5] => 8
    [6] => 9
    [7] => 14
    [8] => 4
    [9] => 13
    [10] => 17
    [11] => 15
    [12] => 18
    [13] => 7
    [14] => 20
    [15] => 10
    [16] => 16
    [17] => 1
    [18] => 11
    [19] => 12
)

2 · return

<?

$array = range(1, 20);

$return = shuffle($array);

var_export($return);

?>
true
HomeMenu