Optimising PHP Scripts
Sraban Pahadasingh April 14, 2020 02:50 PMMainly to avoid generalised coding for better usage of memory and time, use specific and proper logic, statement, inbuilt function.
- Take advantage of native php function
- Cut out unnecessary classes
- Turn off debugging notification
- close file and databse connections
- unnessary loop needs to breaked. unsetting memories after usages of variable and object.
- Use single quote rather double quote
- use identify operator ===
- use proper string function
- calculate only once
- Pass reference to the function to use the veriable outside the function
- Reduce number of hits to the database
- Use intermidate caching technology rather processing same thing again
- Use derived methods instead of base methods in class
- use json rather XML for data interchange
- use isset() always rather using variables directly