Last active
December 16, 2015 08:09
-
-
Save par6n/5403748 to your computer and use it in GitHub Desktop.
str_shuffle();
A shorthand for generating random strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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