function randomName() {
$firstname = array(
'Johnathon',
'Anthony',
'Erasmo',
'Raleigh',
'Nancie',
'Tama',
'Camellia',
'Augustine',
'Christeen',
'Luz',
'Diego',
'Lyndia',
'Thomas',
'Georgianna',
'Leigha',
'Alejandro',
'Marquis',
'Joan',
'Stephania',
'Elroy',
'Zonia',
'Buffy',
'Sharie',
'Blythe',
'Gaylene',
'Elida',
'Randy',
'Margarete',
'Margarett',
'Dion',
'Tomi',
'Arden',
'Clora',
'Laine',
'Becki',
'Margherita',
'Bong',
'Jeanice',
'Qiana',
'Lawanda',
'Rebecka',
'Maribel',
'Tami',
'Yuri',
'Michele',
'Rubi',
'Larisa',
'Lloyd',
'Tyisha',
'Samatha',
);
$lastname = array(
'Mischke',
'Serna',
'Pingree',
'Mcnaught',
'Pepper',
'Schildgen',
'Mongold',
'Wrona',
'Geddes',
'Lanz',
'Fetzer',
'Schroeder',
'Block',
'Mayoral',
'Fleishman',
'Roberie',
'Latson',
'Lupo',
'Motsinger',
'Drews',
'Coby',
'Redner',
'Culton',
'Howe',
'Stoval',
'Michaud',
'Mote',
'Menjivar',
'Wiers',
'Paris',
'Grisby',
'Noren',
'Damron',
'Kazmierczak',
'Haslett',
'Guillemette',
'Buresh',
'Center',
'Kucera',
'Catt',
'Badon',
'Grumbles',
'Antes',
'Byron',
'Volkman',
'Klemp',
'Pekar',
'Pecora',
'Schewe',
'Ramage',
);
$name = $firstname[rand ( 0 , count($firstname) -1)];
$name .= ' ';
$name .= $lastname[rand ( 0 , count($lastname) -1)];
return $name;
}
$namesPartsArrays = [ $firstname, $lastname ];
$namesCount = 5;
$rand = fn($arr) => array_map(fn($n) => $arr[$n], array_rand($arr, $namesCount));
$namesParts = array_map($rand, $namesPartsArrays);
$names = implode(', ', array_map(fn(...$parts) => implode(' ', $parts), ...$namesParts)).'.';
$tmp_firstname = $firstname;
shuffle($tmp_firstname);
array_splice($tmp_firstname, 5);
$tmp_lastname = $lastname;
shuffle($tmp_lastname);
array_splice($tmp_lastname, 5);
foreach($tmp_firstname as $key => $str) {
$tmp_firstname[$key] .= ' '.$tmp_lastname[$key];
}
$name=implode(', ', $tmp_firstname).'.';
define('NAMES_COUNT',5);
$firstnameCount = count($firstname);
$lastnameCount = count($lastname);
$str=null;
for ($i=1; $i<=NAMES_COUNT; $i++) {
$randomFirstname = $firstname[rand(0,$firstnameCount-1)];
$randomLastname = $lastname[rand(0,$lastnameCount-1)];
$str .= (is_null($str) ? '' : ', ') . "${randomFirstname} ${randomLastname}";
}
$str .= '. ';