for($i = 0; $i < count($prices); $i++){
error_log($prices[$i]->anObjectVariable);
}
or
foreach ($prices as $price){
error_log($price->anObjectVariable);
}
None of these seems to work, here are the errors I get:
PHP Notice: Undefined property: price::$anObjectVariable
this is the code which I use to prepare the object(s) and the array.
class price {
public $anObjectVariable;
}
$prices = array();
$p = new price();
$p->anObjectVariable = "PRINT ME IN ERROR LOG!";
array_push($prices, $p);
error_log($prices[i]->anObjectVariable);should beerror_log($prices[$i]->anObjectVariable);, I guess it's a typo ?foreachvariant also fails.var_dump($prices)and/or any other debugging?