Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function makeName() {
- $v = array('a', 'e', 'i', 'o', 'u'); #Vogais
- $c = array('qu', 'w', 'r', 't', 'y', 'p', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'ch', 'tr'); #Consoantes
- $nl = rand(4, 7); #Name length
- $nxt = rand(1, 2); //1 = Vogal; 2 = Consoante
- $str = '';
- for ($i=0;$i<=$nl;$i++) {
- switch($nxt) {
- case 1:
- $now = $v; #Vai escolher uma vogal
- break;
- case 2:
- $now = $c; #Vai escolher uma consoante
- break;
- }
- $str = $str.$now[rand(0, count($now) - 1)];
- $nxt = ($nxt == 1 ? 2 : 1);
- }
- return ucfirst($str);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement