3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
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, )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
61.65 ms | 403 KiB | 8 Q