3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $products = (object)array("barrels"=>array("chemID"=> 1, "catID" => 1),array("chemID"=> 2, "catID" => 1)); $carts = (object)array(array("chemID"=> 1, "catID" => 4),array("chemID"=> 2, "catID" => 4), array("chemID"=> 2, "catID" => 1)); var_dump($products); foreach($products as $key=>$value) { echo $key; }
based on SXtFM
Output for 7.2.0
object(stdClass)#1 (2) { ["barrels"]=> array(2) { ["chemID"]=> int(1) ["catID"]=> int(1) } ["0"]=> array(2) { ["chemID"]=> int(2) ["catID"]=> int(1) } } barrels0
Output for 5.3.19 - 7.1.10
object(stdClass)#1 (2) { ["barrels"]=> array(2) { ["chemID"]=> int(1) ["catID"]=> int(1) } [0]=> array(2) { ["chemID"]=> int(2) ["catID"]=> int(1) } } barrels0