Kevin Yank was an interviewer at SitePoint. he published a Good and Bad PHP Code and elaborated on his views on the merits and demerits of the PHP Code through some Code examples. There are several simple things mentioned here:
<? Replaced with <? Php, which is more in line with XML specifications.
Determine whether it is null before outputting the value of $ _ GET [query.
The extra parentheses in the echo command are removed.
The string is limited by single quotes, saving PHP time to search for replaceable variables from the string.
Use commas instead of periods to save the echo time.
Pass the ENT_QUOTES identifier to the htmlspecialchars function to ensure that the single quotation marks are also escaped. Although this is the most important thing, it is also a good habit.
Many PHP users are familiar with these writing rules, and these writing rules seem very idiotic. However, it took three months for them to recruit programmers who met the above conditions and satisfied them.
Not every company needs to hire programmers like this. But how to develop a good habit may be something that many programmers need to do most, including N + masters. If you are interested, you can view mint brain's full-text translation of this article.