After reading the amazing post by Manuel Lemos Top 10 Wrong Ideas About PHP, I felt I really need to go over those Wrong Ideas once more (just in case somebody missed the original message).
Disclaimer: Manuel Lemos is a well-regarded developer, with lots of contributions, and if you ever used PHPClasses you most probably know who he is. So, I was really prepared to enjoy his new article, provocatively called “Top 10 Wrong Ideas About PHP”. I read the article and then re-read, and then once again – now I am ready to shed some light on my perception of that Top 10.
Take the article below with a lot of humor, as otherwise it loses most of its merits.
If you don’t have much time, here is an abridged version: PHP is a nice language!
1. PHP is not a compiled language (it is interpreted)
- When it comes to speed PHP is reasonably performant, most probably you’ll hit DB bottleneck before you will decide that you need to invent your HipHop.
- So, who the heck worries about such things – I belive, it is quite good enough to know that I do not compile source code before execution, and when it comes to execution PHP does quite well.
- I don’t understand why when talking about PHP, some other languages need to be brought into discussion – I mean languages with completely different philosophy behind them. While it sounds sexy that PHP optcode is very similar to Java’s bytecode, the suggestion that seems to be outcome of such comparison – that PHP as platform is on par with Java – is totally misleading. So, telling that PHP is compiled language just like Java, C# and others (what are they, btw) – is stretching too far.
2. PHP cannot do X (access memory, control hardware devices etc)
- The main idea Manuel is pressing here is the fact that you can write your own extension if you need it. That’s cool but do I have to mention that ability to create extension in C is not actually an exclusive feature of PHP.
- Plus, although definitely improving – decent documentation on how to author PHP extensions is still scarce.
- I love the passage “if you are not capable of developing C or C++ code, you can always hire another developer to do it for you” – I guess yet another exclusive recipe to live happily after in PHP world.
- PHP has crazy amount of ready to use extensions indeed. So, while all arguments about authoring an extension are a bit naive – the truth is you rarely have some area uncovered.
3. PHP cannot do sth that can be done in language X
- There are actually many things that PHP cannot do, which already available in other languages. Anyone who thinks that PHP is feature complete, should code PHP4 till the end of his days. PHP is constantly evolving to include those features – PHP is not an ideal language, so it is improving constantly. I just don’t see why I, as PHP developer, need to be shy that some feature is unsupported yet.
- PHP (to date) has oversimplified object model. Not a different programming style or methodology or anything – it is a mere fact: dominant paradigm in modern PHP development is OO, and currently implemented OO model is very simple. Comparing in this sense PHP to Java, or Python, or Ruby (or even JavaScript) – is missing the whole point. PHP’s simplified object model is actually an asset in most situations, it is simple and (dare I say) elegant. But it has its problems – as any architectural design would have.
- Then as a different solution Manuel declares the ability to execute code in other languages – well, you either didn’t try to use it in production environment or have a very low standards for what is called an integration. Most of extensions to execute other languages are dated, lack documentation and support. So, not an option really.
- I loved the perverted logic of executing Ruby code: convert Ruby into Java using JRuby (hallelujah!!) and then try to execute it from with PHP using some extension. Lots of fun!
4. PHP is only for Web development
- You can have CLI scripts indeed, as you can have in myriads of other languages too. Is PHP very suitable for shell scripting – pretty much so! But I guess anyone who has done shell scripting is smart enough to understand that he can use PHP scripting language, for ..well, shell scripting.
- When somebody starts talking about PHP-GTK seriously it means he didn’t try to do it full scale (hey, anybody did it as a full-time job?). PHP-GTK is a nice experiment – but there are really better tools to do desktop development. You know, if I can hit you with a hammer it doesn’t necessarily mean I should to, so while you can amaze your Java/Ruby/Python/.NET friends that PHP *can* cope with desktop development – do NOT try to actually do it.
- So, you can use PHP for CLI scripting (quite cool by the way!), for desktop development (if you are feeling lonely and masochistic all at the same time), but where PHP really shines is ..um, well..web development. Is it bad? Absolutely not!
5. PHP is controlled by Zend
-
If anyone has such a “wrong idea” in his or her head – do not bother, most probably it is terminal
- So, while refuting such a claim is really nice – if we go on like this we should also state that PHP is not controlled by aliens as well (just in case some UFO-frightened prospect PHP developer feels safe about his time investment).
6. PHP documentation is bad or insufficient
- Who ever told this? I look at my local bookstore shelves: lots of PHP books. Amazon? City library? In different human languages? Lots of various level PHP books. Honestly, I won’t be surprised to look into microwave to find out PHP book even there.
- Then of course we have manual, and comments in it. The great thing.
- I guess the whole point of Manuel mentioning a non-existent wrong idea of PHP having not enough documentation is to refute it (done easily).
7. PHP projects are not reusable because they are not Object Oriented
- Leaving apart the fact that in order to re-use code it doesn’t have to be object oriented at all let’s see what bothers that lunatic to-be PHP programmer, who is worried that universe over there will not be able to re-use his projects.
- Tweaking WordPress is not actually re-using, or does Manuel suggests that judging by the quality of WordPress code base you definitely get a perception that it has already been used (and probably not once!), and you just merely re-using?
- When Manuel started to explain that instead of packages/modules/namespaces to distinguish between two otherwise colliding “print” functions all you need is to use “mysql_” prefix I, honestly, scrolled up and looked when article was published: 18 Aug, 2011 – the very day PHP 5.3.7 release was announced (with a notice that PHP 5.2 is not supported anymore, btw). Facepalm!
- If that brilliant prospect PHP user would approach me and say that he can’t rely on PHP because he can’t have two print() functions, well I will enlighten him (by hitting with the printed version of PHP manual – all extensions included) that there are means (in other languages, and the idea has already been ported and widely used), besides prefixing with “mysql_”.
8. PHP is worse than RoR, Django, X language framework
- Again, not sure why Top 10 Wrong Ideas are not called “Top 10 Wrong Ideas Of Mentally Disabled, and Blind, and Ignorant Social Sci. Students Who Failed Their Mid-Terms”? Comparing apples to bananas? For what?
- Why didn’t the lunatic having this wrong idea compare PHP to *the language X* (be it anything). Additionally clarifying the task at hands? In order to have a qualitative claims lots of parameters should be defined, otherwise comparison is pointless: I doubt you will be able to produce, say, RESTrul web-service any quicker in Ruby, or Python than I will be able to do in PHP. But I wouldn’t even think to compete on meta-programming, DSL authoring – because I am at disadvantage there. Why not to jump into another platform if DSL is absolutely necessary for solving problem efficiently?
9. PHP is not good for high performance scalable web sites or applications.
- Yet another weak/artificial claim/idea, just waiting to be refuted. I love to refer anyone who wonders about scalability of a framework, or language to this answer: Languages, libraries and frameworks don’t scale. Architectures do.
- I wish people stop telling that because of Facebook, we are covered as far as PHP scalability is concerned. FB went as far as creating whole HipHop thing (and no it doesn’t prove the opposite either). FB is quite special – I really doubt that many of us will need scalability at the FB’s extent, so decisions (even decision to create compiler) are quite special case too.
-
After elaborating in dozens of paragraphs, Manuel concludes: “most of those techniques are not language specific”. So, now I guess we can draw an obvious conclusion ourselves: PHP is better than others yet again!
10. PHP developers are cheaper because they are not qualified
-
Why not admit that because PHP is a simple and nice language, there are more people tackling it (to a different level of success), so there are more not-so-qualified developers. When we have high learning curve, we have most of not so fanatic developers sorted out, and this is exactly what happens to starship pilots too (I wanted to be a pilot on a battle starship – but instead slaving in Vim!)
- Whenever someone brings the price tag to discussion, it becomes pointless. The fact is that qualified, PHP or not, developers are not cheap. And there’s nothing in the language that will decrease your rate if you are high profile PHP developer. Period.
Final thoughts:
It is funny that in 2011 (when all decent PHP developers know both weak and strong sides of the language) very prominent community figures (and I am talking about Manuel here) feel the pressure to refute chimeric claims that PHP is any worse/better/suitable than X? Throughout the article, Manuel stresses: PHP is a nice language. Well, it is the fact – you only need to clarify for what problem domain it is nice, whether there are alternatives etc etc
And that applies to any language. So, if you feel guilty of using PHP, don’t. Instead, just go learn some *additional* language – it will enrich your horizons and even make you a better *PHP* programmer!
Take care!



