PHP Best Practise


  • Always use PHP standard tags i.e.  <?php ?> .  To ensure the future version support, Please use standard tags for PHP.
  • Always follow a consistent naming standards.
  • Always use Indent and white spaces in codes. It helps to read and understand the code.
  • Always turn on the full error reporting for development. It will show you complete list of notices, warnings and errors. When you are sending you code to production, Please make sure that you have turn off the error reporting else problems would be visible to users.  You can turn on the error reporting by php.ini. error reporting can be enabled on runtime by error_reporting() function.
  • Always do the client and server side validation wherever there is scope of user input. You can not trust on your users.
  • Always put comment in your code. It will make it easy to understand to others.
  • You should use caching mechanism for the performance of the site. Ex.- memcache
  • Don’t do the deep nesting. It will make the code complicated.
  • Always avoid to declare more variables. It will improve the performance of the applicatio
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s