String Functions

PHP str_shuffle() Function

Topic: PHP String ReferencePrev|Next

Description

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+

Syntax

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

str_shuffle(string);

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

<?php
// Sample string
$str = "Hello World!";

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

Parameters

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