Mistakes to Avoid While Doing PHP Coding

There are some mistakes which can be avoided if coding is done, while keeping the below points in mind.

# Always open and close the brackets for loops or if else condition. It is common mistake to forget about closing the curely braces or loop closing braces.

# End all the PHP lines with “;”(semi-colon).It is good practice  to avoid errors in php.

# I will advice to use <?php and ?>  for opening and closing php tags. Some time other PHP tags cause problem in some cases.

# While writing the functions for the web application, always try yo give a unique name to the functions to avoid name conflicts in functions.

# while naming the files always use the lowercase for naming the files . Don’t mix with lower and Upper cases. it might cause conflict on Linux Server.

# If you are having lots of single and double quotes then prefer to escape them by using escape sequences(\)

# If you are using variable and array , try to give each one of them unique names.

# While declaring a php function don’t pass n number of arguments to the functions instead pass the array as argument.

READ  Man has to have his own HTTP abstraction in Java

Leave a Reply

Your email address will not be published. Required fields are marked *