My PHP Sandwich

What if I could control my world the same way that I control a website? Even if you don’t program I think you can understand this:

<?php
// sandwich options
$meat = array('Ham', 'Turkey', 'Balogna', 'Tuna');
$bread = array('Whole Wheat', 'White', 'Potatoe');
$spread = array('Mayo', 'Mustard', 'French Dressing');

// get random sandwich ingredients
$randomMeat = $meat[rand(0,count($meat)-1)];
$randomBread = $bread[rand(0,count($bread)-1)];
$randomSpread = $spread[rand(0,count($spread)-1)];

// make a sandwich
makeSandwich($randomMeat, $randomBread, $randomSpread);

/**
 * makes a sandwich out of the given ingredients
 *
 * @author Tim Golen (tg)
 *         04/08/2008 - (tg) created function
 * @param string $meat
 * @param string $bread
 * @param string $spread
 * @return array
 */
function makeSandwich($meat, $bread, $spread){
    $mySandwich = array(
        $bread,
        $spread,
        $meat,
        $bread);
    return $mySandwich;
}
?>

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>