How to optimize PHP code ?


  1. Use Native PHP Functions
  2. Use Single Quotes treated as plain string.
  3. Frequently Used Switch Cases instead of if.elseif etc
  4. INCLUDE FOREACH > FOR > WHILE
  5. Disable Debugging Messages
  6. Use Caching Techniques - You can use memcache for the reducing database load 
  7. Close the Connection Get into the habit to unset the variables and close database connection in your PHP code. It saves memory


Related

How to Sort an array of associative arrays by value of given key in php
What are the features of PHP 7 ?