witmar
New Member
Hi everyone.
Today i want to show you script for name generator.How its work?
Like tibia.com, this generate 15 incidental names.
<?php
function del_mult_chars($str) {
return preg_replace('/(\w)\1+/', "$1", $str);
}
function world_name() {
$chars = array(
"aeiou",
"bcdfghjklmnpqrstvwxzy"
);
$end_letters = rand(1, 2) == 1 ? "a" : "ia";
$world_name = "";
for ($i=rand(0, 1); $i <= rand(3, 4); $i++) {
$str = $chars[$i%2];
$world_name .= $str[rand(0, strlen($str)-1)];
}
return ucwords(del_mult_chars($world_name.$end_letters));
}
$main_content .= "<table cellspacing='0' cellpadding='1' border='0'>";
for ($i=1; $i<=15; $i++) {
$main_content .= "
<tr>
<td style='font-size: 10px;' valign='bottom'>$i.</td>
<td style='font: bold 12px verdana;'>" . world_name() . "</td>
</tr>
";
}
$main_content .= "</table>";
?>
if you want to add more names then you must change this:
for ($i=1; $i<=15; $i++) {
If i help you then rep++ me