Jump to content

Globally replace all for-loops


AP81

Recommended Posts

Hi,

 

What I want to do seems a bit far-fetched, but I thought I'd ask anyway...

 

What I want to do is re-define the PHP foreach loop.  The reason why I want to this is:

 

We have an SDK which has taken 5 years to develop (a very complex but well written SDK) and all the previous developers have used foreach loops everywhere.  This has a high overhead, especially that alot of these are looping through arrays of complex objects.

 

I did tests on a number of pages (converting them to for loops) and noticed a reasonable improvement.  What I like to do is apply this globally without having to re-do the entire SDK (which is well over 500,000 lines of code). 

 

I was thinking maybe I could stick something in the prepend and re-declare the foreach loop method.

 

Is this possible?

Link to comment
https://forums.phpfreaks.com/topic/149634-globally-replace-all-for-loops/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.