PHP str_shuffle() Function
In this chapter you will learn:
- Definition for PHP str_shuffle() Function
- Syntax for PHP str_shuffle() Function
- Parameter for PHP str_shuffle() Function
- Return for PHP str_shuffle() Function
- Example - Randomly shuffle all characters of a string
Definition
The str_shuffle() function randomly shuffles all the characters of a string.
Syntax
PHP str_shuffle() Function has the following syntax.
str_shuffle(string)
Parameter
Parameter | Is Required | Description |
---|---|---|
string | Required. | String to shuffle |
Return
PHP str_shuffle() function returns the shuffled string
Example
Randomly shuffle all characters of a string:
<?php
echo str_shuffle("Hello World from java2s.com");
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP str_split() Function
- Syntax for PHP str_split() Function
- Parameter for PHP str_split() Function
- Return for PHP str_split() Function
- Example - Split the string "Hello" into an array
- Example - Set the length of each array element
Home » PHP Tutorial » PHP String Functions