80 and $numwords <= 220){ $st = rand(1,2); if($st = 1){$structure = " s s ";} if($st = 2){$structure = " a s ";} } if($numwords > 220){ $st = rand(1,3); if($st = 1){$structure = " a s s ";} if($st = 2){$structure = " a a s ";} if($st = 3){$structure = " s of s ";} } function gwa($type, $array, $source){ global $pre; $r = rand(0,100); if($source != " s of s "){ if($r < 80){ $w = str_replace(" ".$type." ", " ".$array[getRandArray($array)]." ", $source); } else { $pr = rand(0,count($pre)-1); $w = str_replace(" ".$type." ", " ".$pre[$pr].$array[getRandArray($array)]." ", $source); } } else { if($r < 80){ $w = $array[getRandArray($array)]." of s "; } else { $pr = rand(0,count($pre)-1); $w = $pre[$pr].$array[getRandArray($array)]." of s "; } } return $w; } $name = str_replace(" a ", " ".$adj[getRandArray($adj)]." ", $structure); $name = str_replace(" a ", " ".$adj[getRandArray($adj)]." ", $name); $name = gwa("s", $subst, $name); $name = gwa("s", $subst, $name); $name = str_replace(" pree", " pre-e", $name); $name = str_replace(" ree", " pre-e", $name); $name = str_replace(" dii", " di-i", $name); $name = str_replace(" bii", " bi-i", $name); $name = str_replace(" trii", " tri-i", $name); $name = str_replace(" didi", " di", $name); // $name = str_replace(" a ", " ".$adj[getRandArray($adj)]." ", $structure); // $name = str_replace(" a ", " ".$adj[getRandArray($adj)]." ", $name); // $name = str_replace(" s ", " ".$subst[getRandArray($subst)]." ", $name); // $name = str_replace(" s ", " ".$subst[getRandArray($subst)]." ", $name); // $name = replaceWords($adj, "a", $structure); // $name = replaceWords($subst, "s", $name); $hits = file_get_contents("hits.txt"); settype($hits, "int"); $handle = fopen("hits.txt", "w+"); fwrite($handle, $hits+1); fclose($handle); $lastc = substr($hits+1, -1); switch($lastc){ case '1': $th = 'st'; break; case '2': $th = 'nd'; break; case '3': $th = 'rd'; break; default: $th = 'th'; break; } ?>