Hi All,
I am using a foreach loop within PHP similar to this:
foreach ($class->getAttributes() as $attribute) {
// Work
}
Concerning efficiency, is it better to have a $attributes = $class->getAttributes(); statement outside the foreach loop and iterate over the $attributes variable? Or is the $class->getAttributes() statement only getting called once inside the foreach declaration at the beginning?
(I realize this might not be a big efficiency concern in this case, but I would like to know the principle for this and other larger cases)
Thanks,
Steve