View Single Post
Old 09-10-2013, 03:30 PM  
Vapid - BANNED FOR LIFE
Barterer
 
Industry Role:
Join Date: Aug 2004
Posts: 4,864
Google will love you.

Code:
function spin($pass){
    $mytext = $pass;
    while(inStr("}",$mytext)){
        $rbracket = strpos($mytext,"}",0);
        $tString = substr($mytext,0,$rbracket);
        $tStringToken = explode("{",$tString);
        $tStringCount = count($tStringToken) - 1;
        $tString = $tStringToken[$tStringCount];
        $tStringToken = explode("|",$tString);
        $tStringCount = count($tStringToken) - 1;
        $i = rand(0,$tStringCount);
        $replace = $tStringToken[$i];
        $tString = "{".$tString."}";
        $mytext = str_replaceFirst($tString,$replace,$mytext);
    }
    return $mytext;
}
Code:
$s = spin("{spin|spun} {stuff|shit}");
Code:
echo $s;
Vapid - BANNED FOR LIFE is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote