-
Notifications
You must be signed in to change notification settings - Fork 0
/
a20.php
36 lines (35 loc) · 1002 Bytes
/
a20.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
<?php
$invoice = [
"invoiceNumber" => "INV-123",
"invoiceDate" => "2021-01-01",
"invoiceItems" => [
[
"item" => "item1",
"quantity" => 2,
"price" => 100
],
[
"item" => "item2",
"quantity" => 3,
"price" => 200
],
[
"item" => "item3",
"quantity" => 4,
"price" => 300
]
]
];
echo $invoice['invoiceNumber'];
echo PHP_EOL;
echo "---------------------------------------------------------------";
echo PHP_EOL;
echo $invoice['invoiceDate'];
echo PHP_EOL;
echo "---------------------------------------------------------------";
foreach($invoice['invoiceItems'] as $item){
// echo $item['item'] . " - " . $item['quantity'] . " - " . $item['price']; //string concatenation
echo "{$item['item']} - {$item['quantity']} - {$item['price']}";
echo PHP_EOL;
}
echo "---------------------------------------------------------------";