Subscribe to RSS Feed

Shuffling Letters in PHP and How We Read

Aug 12th, 2009 by matt

Today a tribute to the PHP function str_shuffle( ) !

I could give tribute to PHP all day long,  so I decided to address one function at a time. ;-) This function will take a string and and jumble all the letters in it. So the output of:
$newstring = str_shuffle( "Hello Whats Up?" );
echo $newstring;

Would be something like:
os?U tpalHe lhsW

This function can be used with the substr( ) function to do a variety of cool things (ie. generate random passwords, or account confirmation links).
See Other used for this function at php.net

Outside the topic of the everyday conventional uses of this function; I ran across an interesting post on php.net – Which I thought was very cool.

jojersztajner at OXYGEN dot POLAND
16-Jun-2007 10:27

Aoccdrnig to rseearch at an Elingsh uinervtisy, it deosn’t mttaer in waht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is that the frist and lsat ltteer is at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae we do not raed ervey lteter by it slef but the wrod as a wlohe.
Read jojersztajner post at php.net

Tags:

Leave a Reply