When i tried following loop with reference, i got error.
foreach($category->posts as &$post)
{
$post->custom = value;
}
Error
Fatal error: An iterator cannot be used with foreach by reference in
How can i modify the object with keep it and without creating new array?
Thanks