Skip to content

Instantly share code, notes, and snippets.

@par6n
Last active Dec 16, 2015
Embed
What would you like to do?
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