WireRandom::shuffle()

Shuffle a string or an array

Unlike PHP’s shuffle() function, this method:

  • Accepts strings or arrays and returns the same type.
  • Maintains array keys, if given an array.
  • Returns a copy of the value rather than modifying the given value directly.
  • Is cryptographically secure if PHP7 or mcrypt available.

Usage

$string = $wireRandom->shuffle($value);

Arguments

NameType(s)Description
$valuestring array

Return value

string array


WireRandom methods and properties

API reference based on ProcessWire core version 3.0.252