HomeMenu
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 =
[
    "a" => 1,
    "b" => 2,
    "c" => 3,
    "d" => 4,
    "e" => 5,
];

shuffle($array);

print_r($array);
Array
(
    [0] => 1
    [1] => 5
    [2] => 2
    [3] => 4
    [4] => 3
)

2 · return

<?

$array =
[
    "a" => 1,
    "b" => 2,
    "c" => 3,
    "d" => 4,
    "e" => 5,
];

$return = shuffle($array);

var_export($return);
true