Nov 09

Some Useful Web Development Tips

If you are into expert web development, then you are probably interested in finding out the ways to make your life and the job more convenient and easier. To cut a long story short, you look for the tricks to squeeze the every last performance bit from scripts. Even though these tricks we will share with you will not make web apps much faster, they will certainly give that little but important edge in performance that you might be looking for. In addition, these tips might give you insight into how to write code to be executed in more efficient fashion.

First of all if it is the static method, well use and declare it as static.

The question is: print() or echo() ? Both of these mechanisms work, but if you compare and benchmark them, soon you will realize that echo() is faster then print(). It is because the echo function only print the text and nothing more than that, while print function will return the status to indicate whether it succeeded or not. Checking out the status is in the majority of cases absolutely unnecessary, it is quite pointless to return it. Therefore, echo() is better function. Additional tip is to use echo function’s multiple parameters rather than string concatenation. The reason for this is simple, it is faster.

The doubt: double quotes or single quotes? If you use double quotes, the output will be correct, but your code will check for a variable. In case you are using single quotes, your command is: print whatever is between. So, both ‘ and ” will do the job, but double quotes ( ” ) will only waste processing time. So, there is a difference and you should use single quotes. In fact, even if you use slow print() instead of double quotes is about ten time faster.