PHP str shuffle

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : str_shuffle() function

Description

The str_shuffle() function randomly shuffles a string.

Version

(PHP 4 and above)

Syntax

str_shuffle(string_name)

Parameter

Name

Description

Required /
Optional

Type

string_name

The input string.

Required

String

Return value

The shuffled string.

Value Type : String

Pictorial Presentation

php-string-str_split()

Example :

  1. $string_name='Welcome to w3resource.com';  

  2. $shuffled_string=str_shuffle($string_name);  

  3. echo $shuffled_string;  

  4. ?>