Jenevic PHP
Jenevic PHP
Jenevic PHP
php
$sales = [
[
"sales_id" => 1,
"buyer" => "Ace",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 2,
"buyer" => "George",
"item" => (object) [
"name" => "Milk Shake",
"quantity" => 8,
"price" => 80
]
],
[
"sales_id" => 2,
"buyer" => "Jap",
"item" => (object) [
"name" => "Pizza",
"quantity" => 2,
"price" => 300
]
],
[
"sales_id" => 4,
"buyer" => "Wayne",
"item" => (object) [
"name" => "Turks",
"quantity" => 2,
"price" => 80
]
],
[
"sales_id" => 5,
"buyer" => "Luffy",
"item" => (object) [
"name" => "Meat",
"quantity" => 100,
"price" => 500
]
],
[
"sales_id" => 5,
"buyer" => "Zoro",
"item" => (object) [
"name" => "Beer",
"quantity" => 10,
"price" => 120
]
],
[
"sales_id" => 5,
"buyer" => "Sanji",
"item" => (object) [
"name" => "Soup",
"quantity" => 3,
"price" => 60
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
[
"sales_id" => 5,
"buyer" => "Character 1",
"item" => (object) [
"name" => "Buko Shake",
"quantity" => 5,
"price" => 50
]
],
];
// Item 2 - Output the name, quantity, and price of the item Jap bought.
echo $sales ->item ["name"];
echo "<br>";
echo $sales ->item ["quantity"];
echo "<br>";
echo $sales ->item ["price"];
$total_sales = 0;
for ($i = 0; $i < count ($sales); $i++) {
$total_sales += $sales[$i]->item['price'] * $sales[$i]->item['quantity'];
}
echo "Total Sales:" . $total_sales;
/
?>