1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Article Spinner Script / Function

Discussion in 'White Hat SEO' started by Method, Feb 24, 2010.

  1. Method

    Method Registered Member

    Joined:
    Jan 30, 2010
    Messages:
    90
    Likes Received:
    12
    Occupation:
    Spacebean
    Thought I'd make a little contribution don't really know where I'm supposed to post it so move it if necessary please.

    Not all my work, just a little modified to work for me. Use [ and ] to enter spun words and seperate with a ,.

    function spin($text) {
    while (!(strpos($text,'[') === FALSE) && !(strpos($text,']') === FALSE)) {
    $leftb = strpos($text,'[');
    $rightb = strpos($text,']');
    $spintext = split(',',substr($text,$leftb+1,$rightb-$leftb-1));
    $spinselect = trim($spintext[mt_rand(0,count($spintext)-1)]);
    $brackettext = substr($text,$leftb,($rightb-$leftb)+1);
    $text = str_replace($brackettext,$spinselect,$text);
    }
    return $text;
    }

    TO USE IT:

    $text = "[This,That,Them] Spun [Words,Fish,Sheep]";
    $count = 0;
    while ($count++ < 100) {
    echo spin($text);
    echo "<br />";
    }
     
    • Thanks Thanks x 1
    Last edited: Feb 24, 2010