← All built-ins / str_shuffle()
str_shuffle()
str_shuffle(string $s): string
Parameters
| Name | Type | Description |
|---|---|---|
| $s | string | input string |
Return value
The characters in random order (not cryptographically secure).
Example
$sh = str_shuffle("abcdef");
echo strlen($sh) == 6 && str_contains($sh, "a") ? "ok" : "bad";ok