AP81 Posted March 16, 2009 Share Posted March 16, 2009 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 More sharing options...
Renlok Posted March 16, 2009 Share Posted March 16, 2009 you could try using http://uk.php.net/override_function ive never tried it before but supposedly it works Link to comment https://forums.phpfreaks.com/topic/149634-globally-replace-all-for-loops/#findComment-785745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.