Name generated: Bilbo the Builder
Name generated: Beer Barbecue
Name generated: Stethoscope Sparkleson
Name generated: Spork Hardwood
Name generated: Milk Skullhead
Name generated: Rockette Albuquerque
Name generated: Junior Tull
Name generated: Jenna Divorceman
Name generated: Jill Yustop
Name generated: Chip Stealthman
Name generated: Spuds Haywood
Name generated: Rascal Findlay
Name generated: Rachel Junior Jr.
Name generated: Fancy Handsome-Porter
Name generated: Jeff Wargrove
Name generated: Biff Lad
Name generated: Beef Baggins
Name generated: Chilth Squall
Name generated: Heels Weinstein

Click to get new names

Code:

<html>
<head>
<title>PHP TEST YAHHH</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>

<div class="topbar">
<?php
include 'navbar.php';
?>
</div>

<?php
    
    
// name generator
    // same as 045, but uses a loop to display more names

    
$first = array
    (
        
"Jeff",
        
"Milk",
        
"Stethoscope",
        
"Chilth",
        
"Haywood",
        
"Rascal",
        
"Beer",
        
"Beef",
        
"Chip",
        
"Biff",
        
"Jill",
        
"Jenna",
        
"Rachel",
        
"Rockette",
        
"Heels",
        
"Spuds",
        
"Fancy",
        
"Spork",
        
"Bilbo",
        
"Junior"
    
);
    
    
$last = array
    (
        
"Albuquerque",
        
"Hardwood",
        
"Barbecue",
        
"Stealthman",
        
"Yustop",
        
"Findlay",
        
"Squall",
        
"Divorceman",
        
"the Builder",
        
"Weinstein",
        
"Baggins",
        
"Sparkleson",
        
"Tull",
        
"Skullhead",
        
"Handsome-Porter",
        
"Wargrove",
        
"Lad",
        
"Haywood",
        
"Junior Jr."
    
);
    
    
shuffle($first);
    
shuffle($last);
    
    
$firstLength count($first);
    
$lastLength count($last);
    
    if (
$firstLength $lastLength)
    {
        
$length $lastLength;
    }
    else
    {
        
$length $firstLength;
    }
    
    for (
$i 0$i $length$i++)
    {
        echo 
"Name generated: ";
        echo 
$first[$i];
        echo 
" ";
        echo 
$last[$i];
        echo 
'<br>';
    }
    
    echo 
'<br>';
    
?>

<a href="javascript:history.go(0)">Click to get new names</a>

<div class="codebox">
<h3>Code:</h3>
<?php
highlight_file
("ex046.php");
?>
</div>

</body>
</html>