To PHP Or Not To PHP

From my first article, you could guess that I’m a PHP developer. No, not from the picture, you bad you! From that other clue. Anyway, I wanted to set in stone another opinion in this old as world holy war - can someone who write in PHP call himself a software engineer?

Was für ein wunderschöner Ausblick

PHP in the IT industry is anti-idol. Among developers who mainly use other languages, PHP can be a lifebuoy. For example one can say “I admit - I’ve accidentally put down 10 servers just now and there are no backups, but at least I’m not a PHP developer” and instantly be justified. It’s a trend. But let’s try to figure out why it is like that.

Reasons why people think PHP is bad (from technical to psychological)

Design problems.

Yes, there was a time when PHP was horrible. There even was a time when PHP was not a real programming language at all, but a template engine. Like caterpillars transformation into a butterfly, it transformed into a real one at some point. And this bad motherfucker flies nice nowadays. PHP has its inherited problems, but guess what - other languages have problems too.

Easy to learn, so a lot of “shit-code”

PHP has a very low entry-level. You don’t need to have a lot of technical knowledge to get some shit done quickly. But, most probably, it will not look like something elegant. This is why volumes of bad code are bigger in the PHP world. But it doesn’t mean it stays at that level. With time and effort, one gains the same knowledge as other professionals.

Common enemy

The common enemy connects people. Many developers with different specializations become besties just because PHP is “so bad”. If PHP has existed 2 thousand years ago, the earth could have had a lot fewer wars. But considering wars are the main force of technical progress we could now wear all white, love each other, sing kumbaya, but you would read this article from a papyrus. Now, dear reader, an ethical question for you - would you prefer that or a new iPhone?

Feeling of advantage

There are 2 strategies of how to “become better”: work hard and grow or talk shit about others so you can look better. Well, you get this one.

What is it good at?

First of all - in the scope of writing web application there is nothing PHP can’t do that, for example, python, ruby or node are able to. Of course, each of them has their own strengths and weaknesses.

Facebook initially was written in PHP. Now, I know what you are thinking - “haha, but now they have their own forked language - got you there!”. And you will be right. But even though Facebook doesn’t use pure PHP anymore we should give a credit that PHP is one of the reasons that startup was possible - at the beginning it allowed to progress quickly. So generalization gives us: PHP is good for startups.

Another project written in PHP is WordPress. This is just a CMS. You can argue with me that “it’s not just some CMS - it’s most popular CMS in the world”. And you are right again! A lot of blogs, landing pages, simple sites, even some complex sites are powered by WordPress. WordPress makes the sentence “PHP is the most popular language on the internet” true.

There is a number of other big and really important projects that use PHP. Just to name a few: Magento, Prestashop, Wikipedia, Yahoo, Mailchimp. Projects written in PHP are making an impact. PHP makes an impact.

Last but not least thing worth mentioning is the ecosystem. It’s huge. And the community is great. There lot of frameworks, packages, drivers for any possible use case.

Final words

In my opinion trend “PHP is bad” is caused not as much by the inferiority of PHP as a programming language, but more because combination of “it was bad long time ago” with human biases. You can choose to hate PHP, but if so, please at least have a real reason for it. As Bernard Werber likes to write - love and humor are only things able to save us all.

Piece of useless information - abbreviation PHP was mentioned 29 times (including latter) in this blog post.