Skip to content

Instantly share code, notes, and snippets.

@par6n
Last active December 16, 2015 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save par6n/5403748 to your computer and use it in GitHub Desktop.
Save par6n/5403748 to your computer and use it in GitHub Desktop.
str_shuffle(); A shorthand for generating random strings.
<?php
echo str_shuffle('ABCDEFGH');
// may returns HGACBDEF
// unicode shuffle (qeremy [atta] gmail [dotta] com)
function str_shuffle_unicode($str) {
$tmp = preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY);
shuffle($tmp);
return join("", $tmp);
}
echo str_shuffle_unicode('سلام');
// may returns مسال
/** A little snippet, collected by Ehsan **/
/** We Love PHP and any software writed with this **/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment