This commit is contained in:
2026-03-06 21:27:16 -05:00
parent 1fdfbb1b4f
commit 41ebd4ac62
21 changed files with 1018 additions and 43 deletions
+103
View File
@@ -0,0 +1,103 @@
<!DOCTYPE html>
<html>
<head>
<title>PHP Lab 7</title>
<meta charset="utf-8">
</head>
<body>
<h1>Months of the Year</h1>
<?php
$months = [
1 => "January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
print_r($months);
echo "<br><br>";
$months[13] = "Winter";
$months[14] = "Construction";
foreach ($months as $type => $value) {
echo "The month of $value is month number $type<br>";
}
?>
<h1>Pizza Toppings</h1>
<?php
$vegetables = [
"Green Peppers",
"Mushrooms",
"Olives",
"Chives"
];
$meats = [
"Pepperoni",
"Ham",
"Bacon"
];
$cheeses = [
"Mozzarella",
"Cheddar",
"Provologne"
];
$toppings = [
"Vegetables" => $vegetables,
"Meats" => $meats,
"Cheeses" => $cheeses
];
foreach ($toppings as $type => $value) {
echo "$type: ";
if (is_array($value)) {
foreach ($value as $number => $topping) {
echo "$topping, ";
}
} else {
echo "$type is $value<br>";
}
echo "<br>";
};
echo "<br>";
$prices = [
"Small" => 6.99,
"Medium" => 8.99,
"Large" => 13.99,
"X-Large" => 18.99,
"Supersize" => 22.99
];
asort($prices);
foreach ($prices as $type => $value) {
echo "$type: $value<br>";
};
echo "<br>";
ksort($prices);
foreach ($prices as $type => $value) {
echo "$type: $value<br>";
};
?>
</body>
</html>