str_shuffle()
Published May 22, 2023
Contribute to Docs
The str_shuffle()
function randomly shuffles a string. It generates a different order of characters each time it is called.
Syntax
str_shuffle($string)
$string
is the string to be shuffled.
Codebyte Example
This example demonstrates the use of str_shuffle()
on a string.
Note: The output will vary each time this program is executed, as the
str_shuffle()
function shuffles the string randomly. The function should not be used for cryptography, because it does not generate cryptographically secure random numbers.
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.