-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfdtruck.php
61 lines (45 loc) · 1.38 KB
/
fdtruck.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ITC250 Food Truck Starter Code
<?php
//items3.php
$myItem = new Item(1,"Taco","Our Tacos are awesome!",4.95);
$myItem->addExtra("Sour Cream");
$myItem->addExtra("Cheese");
$myItem->addExtra("Guacamole");
$items[] = $myItem;
$myItem = new Item(2,"Sundae","Our Sundaes are awesome!",3.95);
$myItem->addExtra("Sprinkles");
$myItem->addExtra("Chocolate Sauce");
$myItem->addExtra("Nuts");
$items[] = $myItem;
$myItem = new Item(3,"Salad","Our Salads are awesome!",5.95);
$myItem->addExtra("Croutons");
$myItem->addExtra("Bacon");
$myItem->addExtra("Lemon Wedges");
$myItem->addExtra("Avacado");
$items[] = $myItem;
//create a counter to load the ids...
//$items[] = new Item(1,"Taco","Our Tacos are awesome!",4.95);
//$items[] = new Item(2,"Sundae","Our Sundaes are awesome!",3.95);
//$items[] = new Item(3,"Salad","Our Salads are awesome!",5.95);
echo '<pre>';
var_dump($items);
echo '</pre>';
class Item
{
public $ID = 0;
public $Name = '';
public $Description = '';
public $Price = 0;
public $Extras = array();
public function __construct($ID,$Name,$Description,$Price)
{
$this->ID = $ID;
$this->Name = $Name;
$this->Description = $Description;
$this->Price = $Price;
}#end Item constructor
public function addExtra($extra)
{
$this->Extras[] = $extra;
}#end addExtra()
}#end Item class