Google will love you.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vapid - BANNED FOR LIFE
    Barterer
    • Aug 2004
    • 4864

    #1

    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;
  • valeriyCE
    Registered User
    • Jul 2013
    • 82

    #2
    you mean strpos right and not inStr?
    Freewebcams.com

    http://www.freewebcamcash.com/

    CrakRevenue - 150Countries+

    Best GERMAN CPA
    Plug Rush

    Cheapest Traffic .5cpm

    Comment

    • _Richard_
      Too lazy to set a custom title
      • Oct 2006
      • 30989

      #3
      is this from a BHW thread from 2011?

      Comment

      • _Richard_
        Too lazy to set a custom title
        • Oct 2006
        • 30989

        #4
        another option:

        PHP Code:
        function spin($s) { 
            return preg_replace_callback( 
                '|\{(.*?)\}|', 
                function ($m) { 
                    $e = explode('|',$m[1]); 
                    return $e[array_rand($e)]; 
                }, 
                $s 
            ); 
        } 
        

        Comment

        Working...