Date: 09/09/05 (PHP Community) Keywords: php Is there a version of, or something like str_split in PHP4? My code works on localhost because I'm running PHP5 but my server (non-upgradable) is PHP 4.X.
function random($str){
$count = strlen($str);
$arr0 = str_split($str);
$arr1 = array();
for($i = 0; $i < $count; $i++){
$rand = rand(0, ($count) - 1);
$arr1[$i] = $arr0[$rand];
}
$screenName = implode($arr1);
return $screenName;
}
Source: http://www.livejournal.com/community/php/342557.html
|