str_shuffle – PHP String Functions

Syntax :

str_shuffle (string );

Description :

str_shuffle() function will shuffles a string randomly.


Parameter :

  • string – This is a Required parameter. It is the input string on which shuffle will be performed.
Note : This function does not generate cryptographically secure values, and should not be used for cryptographic purposes.

Output :

This will return a shuffled string.


ChangeLog :

[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, Description
PHP 7.1.0 , The internal randomization algorithm has been changed to use the » Mersenne Twister Random Number Generator instead of the libc rand function.

[/table]


Related articles : shuffle(), rand().


str_shuffle() – PHP Functions Example 1 : shuffles a string.
<?php
$strExample = "Hi from tutorialmines."; 
echo str_shuffle($strExample);
?>

In above example ,We have a string “Hi from tutorialmines.”. Now this function will shuffle the string. Every time when you refresh the page new output will be generated.


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *