2016年2月22日 星期一

10 Tricks to Grasp the Artwork of Writing PHP Code

PHP has turn into probably the most extensively used languages amongst builders for creating net purposes, reminiscent of Fb, WordPress, and different common assets.

Nevertheless, you may discover coding in PHP difficult and a frightening process, particularly once you’re only a novice. So, to save lots of you from making errors when writing PHP code, I’ve listed some nice ideas that may aid you work on PHP language lots simpler.

Mastering PHP

1. Ditch the Use Of

When beginning to write a PHP script, the usual code declaration blocks use “” script delimiters. Nevertheless, novices could make the error of writing the script delimiters as as an alternative of . Make sure that to keep away from such a state of affairs. That is as a result of, when utilized in a PHP script may go in your server, however fails to work on different servers.

Secondly, you need to keep away from using shortcut tags when echoing a variable. That is as a result of, these tags aren’t supported all over the place. You might discover it arduous to stop using shortcut tags, however doing so can assist in making your code extra moveable.

Principally, you simply have to keep away from writing your PHP script solely with shortcut tags reminiscent of . It is best to moderately write it as .

2. Perceive the Distinction Between Comparability Operators

Comparability operators are a particularly helpful a part of PHP. However let’s face it, some programmers fail to find out the distinction between comparability operators, reminiscent of ‘==’ and ‘===’. Keep in mind that == is for equality and checks whether or not the worth on the left and proper aspect are equal. Then again, === not solely seems to be for whether or not the values on each side are equal, but in addition checks whether or not the variable sort is identical on each side or

The post 10 Tricks to Grasp the Artwork of Writing PHP Code appeared first on DICKLEUNG DESIGN 2014.

沒有留言: