The str_shuffle() function randomly shuffles all the characters of a string.
PHP str_shuffle() Function has the following syntax.
str_shuffle(string)
Parameter | Is Required | Description |
---|---|---|
string | Required. | String to shuffle |
PHP str_shuffle() function returns the shuffled string
Randomly shuffle all characters of a string:
<?php
echo str_shuffle("Hello World from java2s.com");
?>
The code above generates the following result.