The str_shuffle
method can be used to
str_shuffle(string $string): string
This method returns the shuffled string as a new string. The original string remains unchanged.
<?php$str = '123456';$shuffled = str_shuffle($str);echo $shuffled."\n";$shuffled = str_shuffle($str);echo $shuffled."\n";$shuffled = str_shuffle($str);echo $shuffled."\n";?>
In the code above, we have created a string and shuffled the contents of the string using the str_shuffe
method.