PHP Disadvantages
By admin • Apr 28th, 2008 • Category: 1.1. Where to Start with PHPIn light of all the advantages, you should also be aware of the problems with PHP.
It’s So Basic Everyone Has An Opinion
One problem I see with PHP is that it is so easy to learn and has such a large community, all willing to provide example code, that you often get some bad advice from people that have no software development background. This just perpetuates poor programming to others, which I don’t agree with.
Ultimate Flexibility
Because PHP is so flexible, it means you can develop things however you like. While this is great, to the inexperienced it means they can often get away with things they should NOT get away with. One great example was a setting in PHP4 that created variables on the fly from forms that were posted, or from query string data (register_globals was the configuration option). So instead of actually referencing the correct $_POST['my_field'] variable, users would just call $my_field. Variables would just seemingly be called from nowhere and you had no idea whether it was coming from POST or GET. This made code very hard to follow, and posed a massive security risk because a hacker could just manipulate your in-code variables by posting them to in the query string…
The obvious was bound to happen. When PHP5 came out, they turned this option off by default due to security concerns, and software broke worldwide. Administrators were rushing to the php.ini file to change the option back. But my point is, this option should always have been off by default, forcing programmers to create and call variables correctly.
Also, this flexibility extends to how you integrate PHP with HTML. We listed this as an advantage, but again, with inexperienced users, this can lead to very complicated code, for no reason. With .NET, you use a codebehind file to reference everything. Some people like this, some people don’t. But the point is you don’t have a choice. Which forces you to code in a certain way. For the inexperienced, this is a good thing, as it teaches them a certain way of programming, one that is pretty easy to grasp. With PHP however, you can choose to have a codebehind file that takes care of the processing, or do all your processing via what I call inline coding (everything in the one page), or a mixture of several codebehind files (which is the one I HATE). I’m seen PHP pages that send off form requests to a codebehind file, which sends that data off to another codebehind file, which then sends the information off to poorly named functions. WHAT THE HELL?! Why make things so complicated?
Anyway, you see my point. In the wrong hands, flexibility can be a bad thing
Too Many Options
An ongoing debate with PHP versus .NET (which largely forces certain things on you, including a Visual Studio editor) is that PHP gives you too many choices for editors. You can choose to edit php files in Windows Notepad if you wish (not advised), or any one of hundreds of open source editors. Then you get commercial editors! What to choose?!?! Well the truth is, you need to spend a day or two trying out different editors, free and commercial (ones that come with free trials of course) and see what you prefer. For me, it’s NotePad++ all the way.
You should make a checklist of things that are important to your development.
For example: Some people use ‘find and replace’ a LOT, so this would be an important bit of functionality for your editor. So example questions for your analysis would be:
- Does your editor have syntax highlighting?
- Do you WANT syntax highlighting? Some people hate it, some people (like me) love it. How fast is you editor at working with multiple files?
- CAN it work with multiple files?
- Does it have tab support for multiple files?
- Does it have an option to save all files that you are working on?
- Does it have an option to group code into projects that you can save?
- etc. etc.
That is how your choose a development tool in PHP. Just be smart about it and the sea of options is actually a blessing.
admin is
Email this author | All posts by admin
