-
Notifications
You must be signed in to change notification settings - Fork 1
/
NameGenerator.class.php
35 lines (23 loc) · 968 Bytes
/
NameGenerator.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
class NameGenerator {
private $_glue;
public function __construct($glue = ' ') {
$this->_first = array("Sarah", "Aaliyah", "Anna", "Arianna", "Ellie", "Steven", "Mary",
"Merlin", "Martha", "Stewart", "Claire", "Shannon", "Michelle", "Chad", "Betty", "Heather",
"Leona", "Mallory,", "David", "Larry", "Richard", "Damion", "Brandon", "Carl", "Amanda");
$this->_last = array("Moore", "Martin", "Jackson", "Thompson", "White", "Young", "Hall",
"Gallagher", "Way", "Fortini", "Giovani", "Fay", "Morgan", "Simpson", "Rutledge", "Stark",
"Herring", "Fields", "Tyson", "Wagner", "Rivera", "Chambers", "Cash", "Hogan", "Weeks");
$this->_glue = $glue;
}
function __destruct() {
}
public function next() {
$first = $this->_first[array_rand($this->_first)];
$last = $this->_last[array_rand($this->_last)];
return $first . $this->_glue . $last;
}
}
$obj = new NameGenerator();
echo $obj->next();
?>