Code: Select all
srand(time());
shuffle($input4);
$newArr = array_slice($input4, 0, 17);
$par1=implode(" ", $newArr);
$input1lc = strtolower($input1[$rand_key1]);
$par1=preg_replace("/(\S+?$input1lc\S+?)/", "<a href=\"$url1\" />$1[/]", $par1);
Also, is there a way to make this only occur once in a paragraph rather than every occurance of the word?