Kevin Yank, who worked as an interviewer in SitePoint, published a good and bad PHP code, detailing his views on the merits and demerits of PHP code through some code examples. It mentions a few very simple things:
Determine whether it is empty before outputting the value of $_get[query].
The extra parentheses in the echo command are removed.
Strings are delimited by single quotation marks, which saves PHP time to search for replaceable variables from a string.
Use commas instead of periods to save echo time.
The ent_quotes identity is passed to the Htmlspecialchars function, which guarantees that the single quotation marks are also escaped. Although this is the most important, but also a good habit.
There are a lot of people who know PHP, and these rules of writing look stupid. But it took them 3 months to recruit programmers who met the above criteria to satisfy them.
Not every company recruiting programmer will ask. But how to develop a good habit, this is probably a lot of programmers need to work hard to do, including n multi-master. Interested friends can view the full-text translation of menthol on this article.
http://www.bkjia.com/PHPjc/486615.html www.bkjia.com true http://www.bkjia.com/PHPjc/486615.html techarticle Kevin Yank, who worked as an interviewer in SitePoint, published a good and bad PHP code, detailing his views on the merits and demerits of PHP code through some code examples. Several of them are mentioned ...