<?php
$results = (object)[
(object)[
"totals_grouped_by" => "day",
"totals" => (object)[
"2018-05-25" => (object)[
"sales" => "0.00", "orders" => 0, "items" => 0, "tax" => "0.00", "shipping" => "0.00", "discount" => "0.00", "customers" => 0
],
"2018-05-26" => (object)[
"sales" => "0.00", "orders" => 0, "items" => 0, "tax" => "0.00", "shipping" => "0.00", "discount" => "0.00", "customers" => 0
],
"2018-05-27" => (object)[
"sales" => "0.00", "orders" => 0, "items" => 0, "tax" => "0.00", "shipping" => "0.00", "discount" => "0.00", "customers" => 0
]
]
]
];
foreach($results as $val) {
echo "Proof of mostly-accurate multi-dimensional array structure: " , $val->totals_grouped_by;
}
echo "\n---\n";
foreach ($results as $val) {
foreach ($val->totals as $date => $subarray) {
echo "Showing $date: ";
var_export($subarray);
echo "\n";
}
}
// or assuming all levels are objects and you only want the one "totals" object that you posted:
echo "\n---\n";
foreach ($results->{0}->totals as $date => $subarray) {
echo "Showing $date: ";
var_export($subarray);
echo "\n";
}
- Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- Proof of mostly-accurate multi-dimensional array structure: day
---
Showing 2018-05-25: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-26: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-27: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
---
Showing 2018-05-25: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-26: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-27: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Proof of mostly-accurate multi-dimensional array structure: day
---
Showing 2018-05-25: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-26: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-27: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
---
Showing 2018-05-25: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-26: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
Showing 2018-05-27: (object) array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
)
- Output for 7.2.0 - 7.2.33
- Proof of mostly-accurate multi-dimensional array structure: day
---
Showing 2018-05-25: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
Showing 2018-05-26: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
Showing 2018-05-27: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
---
Showing 2018-05-25: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
Showing 2018-05-26: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
Showing 2018-05-27: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
- Output for 7.1.0 - 7.1.20
- Proof of mostly-accurate multi-dimensional array structure: day
---
Showing 2018-05-25: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
Showing 2018-05-26: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
Showing 2018-05-27: stdClass::__set_state(array(
'sales' => '0.00',
'orders' => 0,
'items' => 0,
'tax' => '0.00',
'shipping' => '0.00',
'discount' => '0.00',
'customers' => 0,
))
---
Notice: Undefined property: stdClass::$0 in /in/HWMCD on line 36
Notice: Trying to get property of non-object in /in/HWMCD on line 36
Warning: Invalid argument supplied for foreach() in /in/HWMCD on line 36
preferences:
170.19 ms | 403 KiB | 163 Q