Hi, I'm having to develop a site on PHP 5.1.6 and I've just come across a bug in my site which isn't happening on 5.2+. When using foreach() to iterate over an object, I get the following error: "Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference..."
Does anyone know how to convert the following foreach loop to a construct which will work with 5.1.6? Thanks in advance!
foreach ($post['commercial_brands'] as $brand)
{
$comm_food = new Commercial_food_Model;
$comm_food->brand = $brand;
$comm_food->feeding_type_id = $f_type->id;
$comm_food->save();
}