Optimising PHP Scripts

Sraban Pahadasingh    April 14, 2020 02:50 PM

Mainly to avoid generalised coding for better usage of memory and time, use specific and proper logic, statement, inbuilt function.

  1. Take advantage of native php function
  2. Cut out unnecessary classes
  3. Turn off debugging notification
  4. close file and databse connections
  5. unnessary loop needs to breaked. unsetting memories after usages of variable and object.
  6. Use single quote rather double quote
  7. use identify operator ===
  8. use proper string function
  9. calculate only once
  10. Pass reference to the function to use the veriable outside the function
  11. Reduce number of hits to the database
  12. Use intermidate caching technology rather processing same thing again
  13. Use derived methods instead of base methods in class
  14. use json rather XML for data interchange
  15. use isset() always rather using variables directly





Comments powered by Disqus