As you can see here : 3v4l.org/7Kvf5 , PHP7 made foreach() 50% as fast as for(). It depend of version tho
To be honest, that's premature optimisation to use for() instead of foreach() from now. If you really need high-performance, you shouldn't use PHP imo
He/Him/His
I'm a Software Engineer and a teacher.
There's no feeling quite like the one you get when you watch someone's eyes light up learning something they didn't know.
Sometimes it's worth mentionning the fact that with low effort, you can improve a lot the process and (because that's the only thing that interest people) the result
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As you can see here : 3v4l.org/7Kvf5 , PHP7 made foreach() 50% as fast as for(). It depend of version tho
To be honest, that's premature optimisation to use for() instead of foreach() from now. If you really need high-performance, you shouldn't use PHP imo
Unfortunately, sometimes those decisions are made for you by others...
Sometimes it's worth mentionning the fact that with low effort, you can improve a lot the process and (because that's the only thing that interest people) the result