What is your favorite PHP programming trick? -


What is your preferred PHP programming age?

I like myself

  function cached function ($ foo) {constant $ result = array} / div> 

If the result of the function does not change during the course of your application, you can get a more quick call in the cached function.

A well-designed application will not be needed but without much effort, it is very useful to squeeze a lot of performance from the old or bad engineer system.

I worked on the project where it reduced the time for the average HTTP request, about fifty% Because the app was constantly calling the same function without the need for a "fresh" result.

Just keep in mind: this trick can give you out-to-date data! so be careful.


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -