init
This commit is contained in:
29
get-a-name.php
Normal file
29
get-a-name.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// Function to generate a random name
|
||||
function generateRandomName($length = 6) {
|
||||
$vowels = array('a', 'e', 'i', 'o', 'u');
|
||||
$consonants = array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z');
|
||||
|
||||
$name = '';
|
||||
$is_vowel = mt_rand(0, 1);
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$source = $is_vowel ? $vowels : $consonants;
|
||||
$name .= $source[mt_rand(0, count($source) - 1)];
|
||||
$is_vowel = !$is_vowel;
|
||||
}
|
||||
return ucfirst($name);
|
||||
}
|
||||
|
||||
$randomFirstName = generateRandomName(mt_rand(4, 8));
|
||||
$randomLastName = generateRandomName(mt_rand(4, 8));
|
||||
?>
|
||||
<div class="container-zz mx-auto my-20">
|
||||
<h2 style="font-size: 25px; text-align: center;">Get a Random Name</h2>
|
||||
<p style="font-size: 25px;">First Name: <?php echo $randomFirstName; ?> </p>
|
||||
<p style="font-size: 25px;">Last Name: <?php echo $randomLastName; ?> </p>
|
||||
</div>
|
||||
<style>
|
||||
.container-zz{width:100%}@media (min-width: 640px){.container-zz{max-width:640px}}@media (min-width: 768px){.container-zz{max-width:768px}}@media (min-width: 1024px){.container-zz{max-width:1024px}}@media (min-width: 1280px){.container-zz{max-width:1280px}}@media (min-width: 1536px){.container-zz{max-width:1536px}}
|
||||
.mx-auto{margin-left:auto;margin-right:auto}
|
||||
.my-20{margin-top:5rem;margin-bottom:5rem}
|
||||
</style>
|
||||
Reference in New Issue
Block a user