To limit the use of [xx]
in my code I would like to do something C/C++
style :
$nbItem = 30;
items = array($nbItem);
foreach ($items as $i => $item){
$item = new Entity();
$item->setToto();
// do other stuff
}
Of course it didn't work, is there a typo or is just impossible in php
?
Note
I know how to do the same with a for ($i ....)
loop so my question is specifically on foreach