40 PHP Optimization Tips
Datalk.com Computer, Internet, Games Talk FAQ




  Datalk.com - Computers, Internet, Games > Web Design and Web Development > Web Programming Talk

Topic 40 PHP Optimization Tips


Reply
 
November 11th, 2007   Post 1
-HAL-
Administrator
 

Posts: 856
Country: Norway
Microchips: 2,707
Gadgets
Ubuntu Tux redhat Windows
Commodore Intel NVIDIA

Post - 40 PHP Optimization Tips


Just came across this really nice article.
I knew several of them, but there's a few new interesting ones I'll test on my next PHP programming project..
  1. If a method can be static, declare it static. Speed improvement is by a factor of 4.
  2. echo is faster than print.
  3. Use echo's multiple parameters instead of string concatenation.
  4. Set the maxvalue for your for-loops before and not in the loop.
  5. Unset your variables to free memory, especially large arrays.
  6. Avoid magic like __get, __set, __autoload
  7. require_once() is expensive
  8. Use full paths in includes and requires, less time spent on resolving the OS paths.
  9. If you need to find out the time when the script started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()
  10. See if you can use strncasecmp, strpbrk and stripos instead of regex
More here:
http://reinholdweber.com/?p=3

 

Reply





Content Relevant URLs by vBSEO


  Contact Us         Library