Author: Josh
Viewers: 1,581
Last month viewers: 140
Categories: PHP opinions
You may give more importance to some practices than others because your criteria may be different from other developers.
Read this article to learn and see an infographic about what are the top 10 good practices that every PHP developer should know (IMHO of course).
Introduction
Spend enough time around with other developers, and you will inevitably find that they are a knowledgeable bunch who typically enjoy solving problems and sharing opinions.
After hanging around with the PHP developers on reddit's r/php, the user called Mygaming came up with a list of things he learned from his peers. Which got us thinking, what are some of the things that every PHP Developer should know?
With Mygaming's list as inspiration, we set out to illustrate his ideas and round out the topic with a few essential insights of our own.
As a bonus, if you find yourself in a room of PHP developers and want to kick off the conversation, items 3–7 are usually good for a lively debate. Take a stance and let the good times roll!
At the end of this article you can find an infographic that you embed in other pages or even print it if you like.
1. There is no such thing as plain text
Do not assume that all strings are ASCII. PHP will make this assumption. You are the programmer and you must know better. Be proactive about handling Unicode (UTF-8) strings or be prepared to suffer the consequences.
2. All things are not created equal
Know the difference between = and ==. Use = to assign constants. Use == for conditional statements.
Editor Note: if you want to make sure values are of the exact same type, use ===, as == will accept "1" and 1 as the same thing.
3. (Your || My) code stinks
To some extent, whether code is bad or good, that is subjective. Study the best practices for PHP, choose an established coding standard and judge not lest ye be judged.
4. Everyone makes either 6 figures or minimum wage
If you believe the hype, PHP developers fall into two categories: the Jet Set and those "just getting by." Or, in other words, devs who follow rule #5 and everyone else.
5. Everyone charges at least 3x what they're worth
Is it crazy or capitalism? Like everyone else, PHP developers charge what the market will pay.
6. (CakePHP || Zend || CodeIgniter || Laravel) is the (Best || Worst)) ever
Lots of PHP developers have their favorite framework. Don't turn it into a religious experience.
7. (PHPStorm || Sublime Text || Zend Studio || Netbeans) is the (Best || Worst)) ever.
You need an IDE. PHP is unforgiving - even the smallest type will result in a syntax error that stops your code from running. That being said, and IDE choice is not an identity. To each their own (see #frameworks).
8. It's probably been done before
Before rushing out to write a function that re-invents the wheel, read the manual. A PHP function or class probably already exists to accomplish most common tasks. As a programmer, you don't need to memorize the syntax of every function but you should know where to look for the information.
9. Comment the intent of the code, not the solution
10. Don't confuse beautiful code with quality code
Following trends, whether in fashions or functions, is rarely practical. PHP is the normcore of the interwebs. It's not sexy enough to turn heads, but it's comfortable and appropriate for most situations.
Conclusion
If you like this article or want to express your opinion, please post a comment here.
If you agree help spreading this article as PHP infographic from the Udemy site using this HTML.
<a href = "http://bit.ly/10-PHP-Tips" >10 Things Every PHP Developer Should Know<br><br><img src = "http://bit.ly/10-PHP-Tips-Infographic-png" alt="10 Things Every PHP Developer Should Know"></a>
You need to be a registered user or login to post a comment
1,616,820 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
Comments:
3. Nice - Lingaraju Purushotham (2015-11-18 16:45)
Adding one more for best practice... - 0 replies
Read the whole comment and replies
2. Nice read - Stephan (2015-08-04 15:17)
Nice morning read.... - 0 replies
Read the whole comment and replies
1. A tip for #2 - Filip Komar (2015-08-04 15:16)
Yoda style can be useful sometimes... - 0 replies
Read the whole comment and replies