Shuffle characters with PHP

Shuffle characters with PHP

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:


$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.


Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.