<?php

// 2005.11.02
// Even items are words. Odd items represent the number of syllables.

$nouns = array("penis""2""orange""2""mask""1""chow mein""2""poster""2""lotion""2""light bulb""2""car pool""2""pillow""2""ceiling""2""comic""2""sunflower""3""soul""1""font""1""bungalow""3""canopy""3""crib""1""potato""3""cloud""1"); 

$verbs = array("jump""1""cum""1""slip""1""pop""1""rush""1""light""1'""tap""1""severe""2""stew""1""heal""1""slice""1""crack""1""scratch""1""dancing""2""swatting""2",
"blister""2""fuck""1""fly""1""flutter""1""conserve""2"); 

$adv = array("quickly""2""silently""3""harshly""2""sparsely""2""hurriedly""3""badly""2""effectively""4""cautiously""3""recently""3""ecstaticly""4""little""2""verbosely""3""much""1""frequently""3""purposefully""4""ostintatiously""5""erratically""4""morosely""3""deviantly""4""early""2"); 

$adj = array("synchronized""3""ambiguous""4""vaccant""2""glum""1""gorgeous""2""kleidoscopic""5""wanton""2""horny""2""archaic""3""non-chalant""3""conformed""2""devious""3""malnutritioned""4""dead""1""gargantuan""4""succulent""3""elusive""3""prickly""2""flatulant""3""indecisive""4"); 



function 
makehaiku1() { // First line of the haiku.

$loop 0;

    while(
$loop 9999) {
        
$loop++; // repeat 9999 times, then give up
    
        
global $nouns$adj// Use the variables defined at the top.
        
        
$x mt_rand(0count($nouns)); // Set $x to a random number between 0 and the number of items in $nouns.
        
if ($x == 1) { // If $x is odd, it's the syllable count value
            
$x--; // subtract 1 from $x to get the previous item (word)
        
}
        
        
$y mt_rand(0count($adj)); // Set $y to a random number between 0 and the number of items in $adj.
        
if ($y == 1) { // If $y is odd, it's the syllable count
            
$y--; // subtract 1 from $y to get the previous item (word)
        
}
        
        
$haiku1 $adj[$y]." ".$nouns[$x]; // Set $haiku1 to "The (adj) (noun)." 

        
if ($nouns[$x+1] + $adj[$y+1] == 5) { // If there are 5 syllables in $haiku1
            
break; // exit the loop.
        
}
    }
    return 
$haiku1// Pass the value of $haiku1 to makehaiku1().
}



function 
makehaiku2() { // line 2

$loop 0;

    while(
$loop 9999) {
        
$loop++; // repeat 9999 times, then give up
        
        
global $nouns$verbs$adv// Use the variables defined at the top.
  
        
$x mt_rand(0count($nouns)); // Set $x to a random number between 0 and the number of items in $nouns.      
        
if ($x == 1) { // If $x is odd, it's the syllable count value
            
$x--; // subtract 1 from $x to get the previous item (word)
        
}
        
        
$a mt_rand(0count($verbs)); // Set $a to a random number between 0 and the number of items in $verbs.
        
if ($a == 1) { // If $a is odd
            
$a--; // subtract 1 from $a.
        
}
        
        
$z mt_rand(0count($adv)); // Set $z to a random number between 0 and the number of items in $verbs.
        
if ($z == 1) { // If $z is odd
            
$z--; // subtract 1 from $z.
        
}
        
        
$haiku2 $nouns[$x]." ".$verbs[$a]." ".$adv[$z]; // Set $haiku2 to "(verb) (adverb)."
        
if ($verbs[$a+1] + $adv[$z+1] == 7) { // If there are 7 syllables in $haiku2
            
break; // exit the repeating.
        
}
    }
    return 
$haiku2// Pass the value of $haiku2 to makehaiku2().
}



function 
makehaiku3() { // line 3

$loop 0;

    while(
$loop 9999) {
        
$loop++; // repeat 9999 times, then give up
    
        
global $nouns$adj// Use the variables defined at the top.
        
        
$x mt_rand(0count($nouns)); // Set $x to a random number between 0 and the number of items in $nouns.

        
if ($x == 1) { // If $x is odd, it's the syllable count value
            
$x--; // subtract 1 from $x to get the previous item (word)
        
}
        
        
$y mt_rand(0count($adj)); // Set $y to a random number between 0 and the number of items in $adj.
        
if ($y == 1) { // If $y is odd, it's the syllable count
            
$y--; // subtract 1 from $y to get the previous item (word)
        
}
        
        
$haiku3 $adj[$y]." ".$nouns[$x]; // Set $haiku1 to "The (adj) (noun)." 

        
if ($nouns[$x+1] + $adj[$y+1] == 5) { // If there are 5 syllables in $haiku3
            
break; // exit the loop.
        
}
    }
    return 
$haiku3// Pass the value of $haiku1 to makehaiku3().
}




$haiku "<div style=\"text-align: center;\">\n".makehaiku1()."<br/>\n".makehaiku2()."<br/>\n".makehaiku3()."</div>"// put first line,  second line, and third line into the variable $haiku.


echo($haiku);  // display the variable $haiku


?>