PHP - English

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.

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



Kaynak : ‘sitesinden alıntı

Yorum Yap