Home >Backend Development >PHP Tutorial >How to write PHP code to get hired?_PHP Tutorial

How to write PHP code to get hired?_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:37:07858browse

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:

Check whether the value of $_GET[query] is empty before outputting it.
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.

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486615.htmlTechArticleKevin Yank used to be an interviewer at SitePoint. He published an article Good and Bad PHP Code, through some code examples He elaborated on his views on the pros and cons of writing PHP code. There are a few mentioned...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn