You need to create random text but with sense, for example, you have a web page that have thousand of pages and you would like to create text automatically using text spin technique.
Solution:
class Spintax
{
public function process($text)
{
return preg_replace_callback(
'/\{(((?>[^\{\}]+)|(?R))*?)\}/x',
array($this, 'replace'),
$text
);
}
public function replace($text)
{
$text = $this->process($text[1]);
$parts = explode('|', $text);
return $parts[array_rand($parts)];
}
}
}$spintax = new Spintax();$string = '{Hello|Howdy|Hola} to you, {Mr.|Mrs.|Ms.} Smith|Williams|Davis}!';return $spintax->process($string);
2.- add the following Shorcut to your wordpress page.
<!-- wp:paragraph -->
<p>[sc_textspin]</p>
<!-- /wp:paragraph -->
https://gist.github.com/irazasyed/11256369