- var_dump: documentation ( source)
<?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;
}