Free PHP Tutorials

home
Stay at Home and Learn

Shuffle characters

 
Computer Tutorials List

 

 

 

 

 

A rather fun function you can use is str_shuffle( ). What this does is to shuffle all the characters in a string. You can use this to create a quick anagram programme. Try this script:


<?PHP

$full_name = 'anagram';

$full_name = str_shuffle($full_name);

print $full_name;

?>

Only three lines long, but the function takes a variable or direct text and shuffles the characters around.

Next up, something a little more useful - Finding one string inside of another.

<-- Back One Page Move on to the Next Part -->

<--Back to the PHP Contents Page

View all our Home Study Computer Courses