Generating content using RegEx on PHP

MrSomeo

Newbie
Joined
Jan 17, 2014
Messages
3
Reaction score
0
Example:
(Hi|Hello), I am (stranger|student|fireman) and I am looking where to buy some (milk|chocolate)

How it is called and are there any scripts on PHP that would help me decode this kind of expression, when only one word is selected from the brackets. Possible result could be: "Hello, I am stranger and I am looking where to buy some milk".
 
Lol. This is called spintax not regex.

and yes, if you google php spintax script, you'll find loads of info.
 
Example:
(Hi|Hello), I am (stranger|student|fireman) and I am looking where to buy some (milk|chocolate)

How it is called and are there any scripts on PHP that would help me decode this kind of expression, when only one word is selected from the brackets. Possible result could be: "Hello, I am stranger and I am looking where to buy some milk".

Please, remember content is the underlying foundation of your website. You can deny you created the backlinks and Google might forgive you, but you cannot deny questionable content on your money site. Find a good writer and have content written for your money site and your tier one backlinks. Just thought you should know, Goodluck which ever way you decide to follow.
 
Here you go

Code:
[COLOR=#000000]<?
$body = stripslashes($_POST['body']);

for ($j=0; $j< 10; $j++) {
$pattern = '/\{([^{}]*)\}/si';
preg_match_all($pattern,$body,$matches);
for ($i=0; $i< count($matches[0]); $i++) {
$search = explode("|",$matches[1][$i]);
srand((float)microtime() * 1000000);
shuffle($search);
$body = str_replace($matches[0][$i],$search[0],$body);
}
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

$titles = stripslashes($titles);

for ($j=0; $j< 10; $j++) {
$pattern = '/\{([^{}]*)\}/si';
preg_match_all($pattern,$titles,$matchtitles);
for ($i=0; $i< count($matchtitles[0]); $i++) {
$search3 = explode("|",$matchtitles[1][$i]);
srand((float)microtime() * 1000000);
shuffle($search3);
$titles = str_replace($matchtitles[0][$i],$search3[0],$titles);
}
}

$title = explode("|",$titles);
shuffle($title);

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

$summary = stripslashes($_POST['summary']);
for ($j=0; $j< 10; $j++) {
$pattern = '/\{([^{}]*)\}/si';
preg_match_all($pattern,$summary,$matches);
for ($i=0; $i< count($matches[0]); $i++) {
$search = explode("|",$matches[1][$i]);
srand((float)microtime() * 1000000);
shuffle($search);
$summary = str_replace($matches[0][$i],$search[0],$summary);
}
}


//#################################################################
#################Originally made by itrevor
$resourcebox = stripslashes($_POST['resourcebox']);

for ($j=0; $j< 10; $j++) {
$pattern = '/\{([^{}]*)\}/si';
preg_match_all($pattern,$resourcebox,$matchresource);
for ($i=0; $i< count($matchresource[0]); $i++) {
$search2 = explode("|",$matchresource[1][$i]);
srand((float)microtime() * 1000000);
shuffle($search2);
$resourcebox = str_replace($matchresource[0][$i],$search2[0],$resourcebox);
}
}

$article_title = trim($title[0]);
$article_summary=stripslashes($summary);
$article_body = stripslashes(trim($body));
$resource_box = $resourcebox;
?>[/COLOR]
 
Back
Top