Home > Article > Backend Development > How to write PHP code to get hired?_PHP Tutorial
Kevin Yank once worked as an interviewer at SitePoint. He published an article Good and Bad PHP Code, detailing his views on the pros and cons of writing PHP code through some code examples. It mentioned a few very simple things: was replaced by Check whether the value of $_GET[query] is empty before outputting it. Not every company recruiting programmers will require this. But how to develop a good habit may be what many programmers need to work hard on, including many experts. Interested friends can view Menthol’s full-text translation of this article.
The redundant parentheses in the echo command have been removed.
Strings are qualified with single quotes, thus saving PHP time searching for replaceable variables in the string.
Use commas instead of periods to save echo time.
Pass the ENT_QUOTES flag to the htmlspecialchars function to ensure that single quotes are also escaped. Although this is not the most important thing, it is also a good habit.
There are so many people who know PHP, and the above writing rules seem idiotic. But it took them 3 months to recruit programmers who met the above conditions to their satisfaction.