String Functions

PHP str_shuffle() Function

Topic: PHP String ReferencePrev|Next


The str_shuffle() function randomly shuffles all the characters of a string.

The following table summarizes the technical details of this function.

Return Value: Returns the shuffled string.
Version: PHP 4.3.0+


The basic syntax of the str_shuffle() function is given with:


The following example shows the str_shuffle() function in action.

// Sample string
$str = "Hello World!";

// Perform string shuffling
echo str_shuffle($str);


The str_shuffle() function accepts the following parameters.

Parameter Description
string Required. Specifies the string to shuffle.
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties