By Bruno Skvorc

Why Choose PHP Over Alternatives?

By Bruno Skvorc

This article was sponsored by AppDynamics. Thank you for supporting the sponsors who make SitePoint possible!

It’s a popular question. Why indeed should one pick PHP over one of the alternatives? After all, PHP has often been dismissed as a hacky, unusable and badly designed language. Why would anyone choose it, when starting a project from scratch?

Instead of listing the reasons why people do choose it (mostly widespread availability), let’s instead focus on why people should choose it. We can’t talk about that, however, without first mentioning why they shouldn’t.

When you should NOT choose PHP

When considering command line apps

If you’re building a command line app, PHP is not the right choice. Sure, there are decent approaches to building CLA with PHP, but it simply isn’t intended for that. PHP is a web language, first and foremost, and a pure command line app is better built in something else. That’s not to say it isn’t possible – but it’s definitely quicker and easier to do it in another language – not to mention more performant. Building CLI apps in PHP lends itself to the metaphors people use when comparing PHP to a double-clawed hammer. It just isn’t a tool that’s intended for it. For example – Python is pre-installed on most *nix distributions, so you have immediate access to it without needing php.ini hackery, and can start working right away.

When it seems easiest

If PHP seems the easiest of the bunch and that’s your sole motivator, your heart is in the wrong place. PHP can get complicated fast, and while the entry path is, admittedly, easier than with other languages, the pro level shares its complexity with alternatives. Doing serious work is similarly difficult in any language.

Just because your shared hosting provider supports it

If you’re using a shared host, and delight in the fact that it supports PHP (maybe even a not totally archaic version like 5.3), stop. If you’re calling yourself a developer, you should never use shared hosts for anything except the banalities like custom webmail, domain management, or very simple demos. With alternatives such as DigitalOcean offering virtual private servers hosted on SSDs for as little as $5 per month, picking a shared host makes no sense – not when a private instance gives you so much more control. If you’ve got something against DevOps and don’t like setting up your own server (you should really learn to do it, though), many, many cloud hosting providers offer free tiers that are pre-configured for you. Stay away from shared hosts.

Computationally intensive software

When you expect to be dealing with a lot of math, heavy calculation, statistics and the like, there are better options – especially if the app does mostly this, and little of anything else. In particular, functional languages like Scala or the newcomer Dart will perform much better at this task than PHP, which might require more effort than it’s worth to get it to do what you want. It’s also significantly slower at these tasks than languages specifically designed for them.

Sometimes it’s simpler to write a computationally heavy part of the application in a language you’re already involved with in the current app, but more often than not that’s a lazy shortcut. The discomfort of having to install a helper language or VM and build part of the app as a separate application is quite often offset by the long term gains, especially when traffic starts to demand it. There’s a reason Twitter’s back end calculations are all in Scala now even though their frontend is still RoR.

PHP is highly learnable

The problems listed above are problems of inadequate knowledge and experience, and naturally, when someone uses PHP for such a purpose, the end result is suboptimal – adding bad press to PHP’s already tarnished reputation. What PHP is good for, is any web oriented scenario that needs to be developed quickly, and needs to perform really fast.

PHP sports an enormous community. True, the vast majority are newbies, but once you weed out the chaff, what remains is a handful of dedicated professionals like Phil Sturgeon, Josh Lockhart, Mike van Riel, Anthony Ferrara and many, many more. A dozen of highly dedicated professionals who admit to PHP’s faults but also work hard on educating the public and fixing these issues can provide a wealth of knowledge. Coupled with excellent resources like SitePoint’s forums, StackOverflow and PTRW, problems encountered in PHP are easily solved, and progress is usually both rapid and highly educational. Unless the questions you ask are downright stupid (and yes, there are stupid questions), the community is non-elitist and always ready to help.

The number of open source PHP projects as well as books and courses one can learn from is plentiful, and with patience and guidance one can become highly proficient in the language in a relatively short period of time.


Dispelling the bad press

PHP has matured significantly since the last time people collectively bashed it, and is inheriting more and more modern features from other languages. Prejudice is prevalent, and one should learn to recognize it. As this excellent MailChimp blog post from 2010 says, it’s not the tool, it’s how you use it.

PHP allows rapid prototyping of all types of applications, and can get you up and running in no time. It’s a fast and robust language that outperforms RoR and Python by a lot in complex web apps, and with the added benefits of projects like HHVM and Phalcon, PHP’s performance is unchallenged in the land of dynamic languages. Typing is coming in both regular PHP and HHVM’s Hack in at least some form, and as giants like Facebook continue to work on it directly, PHP can be taken ever more seriously.

Now, before jumping on the bandwagon and yelling “just use NodeJS, it’s teh best!!11” or “MailChimp would have been better off using NodeJS from the start”, please first consider how hacky and fragmented the JavaScript world is in its current form. So much younger than PHP, the frameworks it offers already outnumber PHP’s – a frequent point of ridicule among PHP haters. NodeJS is 5 years old, and its most recent version at the time of this writing is v0.10.25. The developers seem so unsure of it, they refuse to let it go past even 0.1 after five years, let alone venture into 1.x waters. There is also constant disparity between the various solutions, and every single one claims to be “a simpler/better/faster way to do X”. The community is enormous, but horribly fragmented. This Tweet rings particularly true:

It’s not my intention to bash other languages – other people can do a much, much, much better job at bashing JS than I can – what I’m trying to point out is the fact that one can nitpick on the downsides of absolutely any language. Just like in life, if you focus only on the bad stuff you’ll never experience the good – PHP’s downsides have been taken care of for the most part by libraries and frameworks, and while one may argue that a “real language” doesn’t need patches or the help of big companies to work, one could counter by asking what exactly Java, NPM or PUB libraries and packages are, if not patches and improvements to the language, adding missing functionality someone else was kind enough to build.

So let’s stop focusing on how bad X language is, and start working on projects that demonstrate the superior nature of our choice. Yes, there are projects out there dragging it down – WordPress is one such project for PHP – but if we persist and build awesomeness with best practices in mind, we can dispel this bad reputation and start rebuilding the PHP world we love.


PHP is an excellent choice for new projects regardless of complexity. The PHP world has been evolving at a truly rapid pace in the past few years, and some revolutionary new features can be put to use even today (refer to the HHVM and Phalcon links above). Far be it from me suggesting PHP should be the only tool in your toolbox – being fluent in more than one language is just as useful in programming languages as it is in natural languages – but it definitely will not hurt to master it. PHP will grant you the ability to go from idea, to prototype, to production in days – and that’s a claim not many languages can make. Recent advances like built-in OpCache and virtual machines like HHVM take the language further, allowing you to greatly reduce your cloud hosting bills, and performance monitors like AppDynamics will let you milk it to its limits.

When considering your next project – don’t ask yourself “Who hates PHP?” or “What will people think?”. These are questions of vanity and insecurity. You think anyone assumed MailChimp, the system that powers millions of emails per day, was built on PHP before they “came clean”? Instead, just do your best and build.

  • Simon Timms

    Dart? Do you perhaps mean Go? Dart is a competitor/companion language to JavaScript while Go is the system programming language(think C).

    • No, I mean Dart. But sure, Go is a valid alternative too.

    • Evan Byrne

      Go is a fantastic language for server-side web development. I’ve programmed websites in PHP for about nine years now and I’m switching over to Go for my personal projects.

      • On a side-note, if you’d like to show people what Go can do and what you learned so far, get in touch.

        • PayPal, LinkedIn, Groupon, and quite a few big orgs are using node, but I’ve also been in touch with a few that have gone with Go on the back end, primarily in order to run on Google’s AppEngine.

    • Taylor Ren

      Go is definitely a candidate for server apps.

  • ElDerecho

    I might not use it to implement a systems-level command line application, but PHP is an excellent choice for command line applications that work as part of a larger web application. You get the benefit of very mature database support and being able to reuse code. I use it a lot for CLI apps that are run via cron.

  • You want to dispel the PHP bashing, so you engage in bashing node.js?

    Yes, there are a lot of node.js libraries, but consolidation seems to be occurring around Express, Sails, and a few other major frameworks.

    And at least they are libraries, to be used, or not, as desired. PHP, OTOH, once seemed bound and determined to extend and embed every single function it could find. Further, it can’t seem to figure out if it wants function names like doThis() or do_that(), whether main argument parameters are first or last, and on and on. I once joked that PHP was like MacDonalds, with over 1 million crappy functions served.

    Now, to be honest, PHP has gotten better in that regard. But the one thing I really have a hard time getting past is that it’s an ugly language, syntax-wise. I’ve programmed in C, C++, Pascal, Python, Javascript, Objective-C, Java, Delphi, Modula, Logo, SQL, HyperTalk, Smalltalk, BASIC, Clascal, Forth, assembly, and many. many more, and yet PHP still manages to set my teeth on edge every time I’m forced to use it.

    • Kaloyan Doichinov

      You want to bash PHP, so you engage in retaliation to the non-existant bashing of nodeJS?
      Bruno isn’t “bashing” anything, he’s merely pointing out what happens when we programmers aspire to be unique in place of everything else. This results in numerous “forks” of really the same damn thing. That tweet above may be a joke, but it’s closer to the truth than many would admit. While having an idea is great, it’s best when one joins a team of like-minded people and works together with them instead of reinventing the wheel just for the sake of having one’s name in the Readme. Why do we have so many frameworks for PHP? Why do we have so many libraries for JavaScript? Why do we have a multitude of desktop environments for Linux instead of one or two really great ones, like Windows does?

      And, please, PHP is ugly? And what, JavaScript is prettier? Also, I wonder how you handle C++, given the fact that it’s almost exactly like PHP (to be more precise it’s actually the other way around but nvm)

      • Quite right. A nasty angle can be found on anything, it’s about focusing on what makes it work for you, not what doesn’t.

      • I’ve used it, and use it, as I’ve done a lot of PHP/WordPress sites, plugins, and tools, but as I said, it sets my teeth on edge.

        As in prefixing every single variable with $? I can see doing that in embedded text substitution, but even in scripts? I thought we’d left BASIC-style languages that required variables labeled a$ and n% behind.

        Then there’s objects. Want to reference an object method in most modern languages? That would be obj.method(); not $obj->method(); Properties? Same. Of course, PHP can’t use dot syntax anyway, because they decided that a . b made more sense than a + b or a & b.

        Or ‘bar’ => ‘baz’ for array/dictionary syntax instead of x[y]? Or :: to resolve scope?

        When in doubt, make up a new operator…

        • You’re nitpicking the syntax problems we’re all aware of, and are discussed in the links in the first paragraph. It’s folly to expect every language to have the same syntax.

        • Paul Johnston

          The PHP designers have mentioned the $ prefix (NOT a suffix as in old BASIC) as a quick way to include variable values in strings, given that they liked the way Perl did it. They made a choice and hindsight is 20/20. I don’t fault Benz and Ford for not making fuel-efficient cars like we have today.

          • As I pointed out, I can see doing that in embedded text when you need to do substitution, but even in scripts? Regardless, I don’t fault the Model-T either.

            But I do drive something a little more modern… (grin)

    • I personally did not think that this is a bash towards node.js, it serves more like an example. It’s all a matter of interpretation of the article.

      As for the teeth on edge, don’t use PHP and it will save you dentist visits :)

      Joking apart, my point is that one should use the right tool for the right job as Bruno states above and PHP should not be discarded just because certain people don’t like it.

      Yes it has many functions, yes some of them are not named as others i.e. there is little uniformity, and yes you cannot inherit from multiple classes.

      All the above are drawbacks that you can find in any language, even less mature than PHP. The decision is up to the developer to remove the hype and popular opinion of a language/tool and decide for themselves whether that language suits their needs or not.

      As far as I am concerned, PHP is an excellent choice for my needs and so far for the needs of my clients.

      • Exactly, thank you. Well put.

      • Chris Root

        They why go on about node not getting past 1.0? How do you know this is a lack of confidence on the part of the developers of node.js in the software? node.js is already being used in production in a lot of places. Perhaps the core developers have a particular goal in mind for a 1.0 release. PHP development has had it’s own version setbacks. Where is 6.0 (something you could ask perl enthusiasts as well)? If you want to further the “best tool for the job” line then perhaps you could have outlined where node.js is less appropriate as you did with PHP and command line apps. For instance, node is less appropriate for desktop apps and excels at doing apps based on network connectivity. Doing a socket server in node is trivial compared to PHP and many other languages which is why if I need a web service to serve data to a PHP or Ruby application I’ll use node.js.

    • Like the others say, this isn’t a bash. And like the article says, others can do a much better job at bashing JS, or any other language. Yes, there are inconsistencies, and yes there are some weird artifacts from the past. But PHP is maturing rapidly, and has matured immeasurably since you last used it no doubt. Whether or not it has some ridiculous remnants of low quality in the core is irrelevant – focus on what works for you in a language, not what doesn’t.

      • Since I last used it? That was about a month ago. Doubt if it’s “grown up” that much… (grin)

        Like I said, it’s a clunky language, with quite a few inconsistencies and a metric ton of legacy code to support. (Which will probably be its downfall, BTW.)

        PHP has survived pretty much due to WordPress and, to a lessor extent, Drupal, and its fate will be heavily intertwined with the success of those platforms.

  • Capaj

    Bashing other languages? Only other language you have bashed is Node.js. I think you might be jelaous of JS. I think deep down you know PHP is going to die much sooner than both JS and Node.js. Sad isn’t it?

    • Chris Root

      The use of JS is expanding and if it expands into a new territory the developers in that territory are going to be suspicious and set in their ways. Personally I don’t get emotionally invested in any language or in any technology company and frankly I have never seen a language that doesn’t have it’s drawbacks. JS is now in the server and desktop space and PHP has made some inroads there as well (GTK, Tidekit, TideSDK) with an implementation done well I don’t think it’s anything to get upset about. They are just tools and if you are comfortable with a tool why not experiment with it?

  • TheBox193

    I feel that Laravel is bringing a lot to the table for PHP. I have been using it for several projects. Anyone else feel the same?

    • I feel like Laravel, HHVM and Phalcon are the three main drivers of PHP right now.

      • ferisoft

        What is it bringing to the table that no other framework isn’t? Actually Symfony is bringing probably more (being at the core of Laravel) by meaningful components and sensible architecture. But I can’t see how one framework of which there are probably 1000s in the PHP world would change anything really. And what driver can HHVM be to the community? I completely disagree, so you are going to be building something with massive scale in mind and say ok PHP on HHVM is a sound choice? Or you already have a giant codebase and you have scale issues and you are going to say, okay lets rewrite it all now so its compatible with HHVM, again highly unlikely. To me HHVM is a very interesting proof of concept with limited real life application as of now…

        • I agree no app should be rewritten to fit HHVM if the codebase is already large and established. I wouldn’t hesitate in picking HHVM for projects I’m starting out with, though.

      • As I mentioned below, the “main driver” behind PHP is WordPress.

        • Not in the true sense of the word. WP doesn’t drive PHP anywhere except downhill, imo. It helps spread PHP awareness, but doesn’t contribute to quality in any way. In fact, it actively harms it.

          • Define “drive”. HHVM and the other technologies are the drivers behind improvements, yes. But check the stats: the vast majority of all PHP installations and sites run WordPress. Kick WP and Drupal out from under the bus, and the remaining number of non-CMS-based PHP sites dips precipitously.

            Few businesses and companies seem to choose PHP by choice. Ruby was the new hotness, now it’s node. Take out the folks using Java and C#, drop out WP/Drupal, and the remaining slice of the pie is getting rather thin.

            PHP suffers from many of the issues that plagued ColdFusion. Sadly, in too many cases it was too easy to learn. So too many non-developers read half a book and started writing web sites and web applications that were a complete hash from a code and architectural perspective.

            And yep, both languages added better syntax, added objects and classes and inheritance… and most people ignored them and kept on doing what they’d been doing all along.

            As you, yourself, pointed out, WP drives PHP awareness and adoption. If HHVM is going to succeed, it needs to support all modern versions of WP and all its plugins out of the box.

            And if PHP is going to continue to grow, then IMHO the PHP community needs to get behind the WordPress devs and work on a total rewrite of WordPress that leverages the new technologies and brings both WP and PHP out of the dark ages.

          • I disagree. The PHP community, in my opinion, simply needs to make something better than WP, thus proving that WP is a replaceable pile of procedural 20th century hacks.

          • Plenty of people have done something new. But if WP did it and provided a migration path then it could drag the existing user base along for the ride.

            If someone else does something new, then it’s faced with a major, major awareness problem and an extremely drawn out adoption curve.

          • Very true. But do you really believe people who are comfortable in WP’s code *right now* would be comfortable moving to proper coding practices after years of exposure to something that awful? It would be a culture shock to them, not unlike starting with a brand new tech/lib/framework from scratch. Sometimes the inertia a bad project has from before isn’t worth it.

          • dojoVader

            I agree with Bruno, everything feels like a Hack in WordPress, its just terrible, yes WordPress is popular but it doesn’t promote PHP in the right way, after using Zend,Zend 2 and Yii, i have to admit, WordPress could have been a lot better, however with that being sad, am more intrigued about Phalcon because its actually implemented in C, does someone with C++ Intermediate knowledge still work with Phalcon.

          • Mike

            I agree with both Bruno and Michael. WordPress is kind of like the Shaun White of CMS. Everyone seems to hate it but you can’t deny what it has done for the CMS world. I know I know it started out as a blog and is not a CMS. Whatever, it still has morphed into one of the world’s most popular CMS’s. Now to Bruno’s point, yes you are correct, unfortunately, WordPress code started out as a procedural pile of..well you know. But there have been many updates over the years to change that. The main issue WordPress faces is trying to maintain legacy support. Once thing all developers can learn from WordPress is what challenges you will be faced with if you build something that becomes popular and is used by millions of people. When this happens you simply can’t change everything overnight and tell your legacy users “sorry you’ll just have to comply with our new coding standards”, especially when so many businesses depend on WordPress as a cornerstone of their business model. So I do agree that WordPress breaks all the rules of traditional design patterns, but I feel that the WordPress community has been very responsible in their approach to supporting legacy code that so many people rely on.

          • Legacy support is a necessity of business, but no excuse to utterly suck. They’ve only recently transitioned to mysqli from mysql, for crying out loud. They should have done what all popular software does – support a legacy version until date X, and begin pushing out version X+1. In time, kill support for X, giving people enough time to upgrade, AND a choice not to do it if they want.

            Operating systems, programming languages, frameworks, etc – they all use this pattern. Why WP couldn’t is beyond me.

          • Mike

            Agreed. “utterly suck” is a little harsh. But it should not be surprising that WordPress does not do things like other popular software. The “framework” itself is the only one like it out there. Not saying it’s right, just saying it is unique. That is usually the argument, that it is not a “framework” at all and it should conform to traditional coding patterns and business standards. Personally, WordPress is NOT my first choice on projects because of most of the reasons you have mentioned above. But I have to think there is something to be learned from the WordPress community since it is one of the largest communities on the web. So back to the title of the article “Why Choose PHP Over Alternatives?”, I don’t know, but the topic has been a hot one for a long time so if there is this much discussion about it, I feel it’s not going anywhere anytime soon. So getting back to what you just mentioned above the language you choose to develop in is only part of the equation, having the correct business procedures in place, coding standards and proper requirements when building projects is what, in my opinion really maters. So yes Bruno you are correct, I just like to play devil’s advocate.

          • Christian Bonato

            Hear ! hear !

      • gafitescudaniel

        You are right on this but I would add Symfony and Composer to the list as well.

      • Adil Shahzad

        Bruno, What do you think about Yii as a framework. I’m about to start the project and would like togo with the framework. I’ve seen Yii very good performance wise but after reading few articles on sitepoint, I’m thinking of switching to Phalcon. What do you suggest?

        • When the choice is yours, I will always recommend Phalcon. I haven’t used Yii in production, only played around with it.

    • Pratik Shah

      +1 For Laravel

  • Taylor Ren

    Just add one more point:

    It probably won’t be a good idea to use PHP to develop any GUI standalone apps. Luckily, the questions on this is becoming less and less.

    PHP is fast, not only in the sense that it runs fast, but also that it can deliver a result – even when it is premature, sub-optimized, fast. Sometimes, the “effectiveness” weighs over “efficiency”.

    • Jingqi Xie

      I would rather say development efficiency and runtime efficiency.

  • ferisoft

    I have been developing in PHP for the past 5 years, I have to be honest it sucks. Maybe it was a good choice when I first started using it but the language landscape changed significantly, If someone came and ask me what should I learn i wouldn’t recommend PHP. Its really not the language that is bad (even though it is pretty quirky), its the ease of entry and the number of sub-standard developers who release piles and piles and piles of crap upon the community. Almost every open source PHP project or library has crap in it, which is unfortunate. You mention some in the post such as WordPress, I would argue its prob 90+% of the libraries and applications not only WordPress. Because of the ease of entry, authors focus on simplicity and end user friendliness and completely disregard modularity and architechture, just banging out dumb code. While I have seen some sensible changes in the direction primarily in the face of Symfony and their view of how stuff should be done (which is somewhat Spring’s view in Java), it’s still too little too late and most of the new developers in PHP disregard it as being “too complex”, even though its de facto the correct way… My 2 cents.

    • Trent Reimer

      I’ll be the voice of dissent here. We were all newbs once. Guessing I’m probably not the only one here who has opened some of my own code from years gone by and face-palmed. That’s just part of learning and growing.

      I’m OK with the newb-friendly nature of PHP. The fact someone can build a comment box (whether or not it becomes a spam conduit) doesn’t prevent experienced developers from building enterprise level applications.

      • jpg5f2

        Perfect point. I barely get through a single project without wishing I had not done SOMETHING differently. That is the nature of developing when you have clients and timelines. Never have I blamed other developers for releasing crap code though. What other people do with php, or any other language, does not change what I can or can not do with it.

        • ferisoft

          It does when you have to rely on third party code, unless you want to write everything yourself…

          • jpg5f2

            You don’t have to rely on third party code. That is a choice. There is certainly not a lack of quality PHP code. One could argue that it is diluted with bad code which I somewhat agree with. There is also lots of disgusting and horrible food… dont eat it.

          • ferisoft

            Well if you wanna express it metaphorically think of PHP as the restaurant. You know there is some good food in there but most of it sucks. So you have to dig deep through the menu and ask around or experiment yourself (read through loads of source) to find the decent one. While another restaurant just never dissappoints or very rarely and its part of its DNA to do so, so you can count you will have good food there most of the time. That is the case when you have a more focused language with a more experienced and dedicated community. It cleans itself on its own. With PHP the crap just comes in from some many places on so many levels its hard to keep track. And after all the idea of using some dynamic language like that with loads of libraries is that you can quickly piece together stuff and ship faster, otherwise why even bother with a scripting language. It fails for me on many levels. To be honest I can no longer see areas for myself where I can say yeah PHP shines here I will definitely use it. (maybe shared hosting … )

          • jpg5f2

            I like this metaphor for your point, but I don’t see it as completely accurate, as PHP isn’t “creating the menu” (PHP does not control everything that is released or created as a restaurant does). It is simply providing the ingredients, so to speak. This doesn’t, however, change that you might have had a lot of bad experiences with those ingredients, and therefore are unwilling to try it again. I get it, I just don’t feel that way.

          • I’m going to chime in here and say that I agree we, as the PHP community, are too open to newbies – bad code should be shot down before it grows wings and gets a chance to fly all over the place. I agree that the vast majority of open source projects in PHP are awful, but I also claim that we can fix it if we collectively diss the bad stuff.

          • Trent Reimer

            I just don’t see the need to bash people’s first efforts, and especially not the need to exert negative peer pressure and shame against people who are new to something. If we don’t like the code we don’t need to use it.

            I don’t hate children for being short either.

          • ferisoft

            Completely agree but I have just been too fed up and usually when I critisise something I get trash back instead of any meaningful response on the constructive critisism so mostly I have given up :D

          • Chris Root

            Security being a big part of that. The Target breach was done in part by using SQL injection. Considering the techniques available to prevent that, there should never be another SQL injection attack ever again yet we see them often. If we want the situation to get better then we have to work together to wipe clean the side effects of the language growing up from where it had been. I dare say some language devs for langs used widely today probably learned from the mistakes that PHP developers made being on the cutting edge. Now it’s time to clean up things and start teaching others the new and right way to do things.

          • It’s not that the PHP community is too open to newbies, it’s that the PHP community has a dearth of people willing to teach said newbies best practices.

            If we had more people interested in teaching and mentoring the community at large, the average competence of the entire community would increase.

          • There’s a lot of interest to train them (see but there’s just too many to handle, most unwilling to learn best practices and looking for quick overnight mastery shortcuts. The abundance of bad tutorials online doesn’t help either – we should first focus on getting rid of the bad, and they’ll automatically flock to the good.

          • jpg5f2

            I agree a little more than I’m letting on. But I’ve seen some pretty terrible code in open source projects in many languages. Ruby gems, java, etc

          • ferisoft

            Sure, but much less so than PHP. There is nothing perfect…

      • ferisoft

        While this is true its not completely irrelevant since the majority of php libraries and even more so php projects which the php takes so much pride in (wordpress, opencart, phpbb, etc ,etc) started as learning projects and carry the crappy DNA all the way through. You see it in almost every library or open source PHP code you open. Honestly I have seen very very few libraries with proper architechture, properly tested, and though of. Really 90% of php open source code is very stinky and if you are to develop in PHP you are in some sense forced to use it, otherwise why would you, I guess we can all agree that if it wasn’t for the huge amount of out of the box app’s in PHP its popularity would be much lesser and we can all agree there are much more superior languages. Its just that this always haunts me, I would start working on some PHP project, I need a few general libraries, I would google around (composer or whatever), and when i see whats going on under pain kicks in ….

  • I agree in the point of view that PHP is not bad, or ‘less cool’ than other languages. But I really apreciate the possibilities ecosistem that developers have when thinking of a new site: PHP, Ruby, JS, Python… Many times you are not looking for performance at all (a link you use rants about Rails using performance as an argument), and you ‘enjoy’ more developing in a language more or less. I think that competition makes them improve faseter. BTW I want to check the Laravel and Phalcon frameworks, a big trend right now…

  • Ivan Panfilov

    Srsly! Who needs Scala if Java 8 is comming?
    And Dart LOL? Dart just failing – because it does not have native support for even in Google Chrome

  • Fair enough, I suppose, but I’m not familiar enough with Node to discuss its weaknesses confidently – hence the links to other people’s posts about JS being bad. Agreed, PHP has had its folly with version numbers too.

  • Peter L

    So, I just read some reasons not to choose PHP, then some reasons to bash it are countered, primarily by claiming top performance and pointing at some big guys, like mailchimp and facebook. But nothing about the fact that PHP has no type safety, is too loose in structure, making it harder to build a good IDE for it. I think for most people cheap shared hosting is still an important reason to choose PHP. In a VPS – on which I agree with the author is the right choice for professional use – preferring ASP.NET, or Java over PHP, is a no brainer to me. Don’t tell me PHP is faster. The thing that makes PHP fast, is C++.

    • PHP is faster – when done right.

      There exist dozens of excellent IDEs for PHP ( . Unless you’re the one building the IDE, I don’t see how the frustration of it being difficult to build applies to you. Type safety is completely absent (or optional) from almost every scripting language in popular use these days, and loose structure is alleviated with frameworks and coding standards, much like in any language. Contrary to other languages, however, type safety is coming to PHP via Zephir and HHVM/Hack, and even in part via PHP itself.

      Up for a dare? Let’s put online a simple but identical application built in Java and in PHP on two separate but identical servers. DigitalOcean’s tier one would do. The first criterion would be the time it took to get it up and running in either language (from planning to deployment, everything). The second will be the resource consumption when bombed with an intensive benchmark. These calculations would then be applied to modern cloud hosting bills to find out how much money exactly either language saves over the other. The next stage of the “competition” would be adding a feature the community would request, which doesn’t exist in the original app yet. The time of construction of this additional feature would also be compared then, indicating extensibility of the original app and structure of the language used.

      • Soulice

        I know some RoR devs that would disagree. And I noticed your language choices and hosting scenarios leave out .NET options. I have seen classic ASP sites scream and outpace PHP “when done right” Nearly any language, when the code is clean and architecture well thought out, can be fast.

        • That’s true. “When done right” is a hairy claim.

  • Chris Mortimer

    I have to disagree with your comments ‘Stay away from shared hosts’. Perhaps you have had a bad experience but you seem to miss the point of shared hosting. Yes a VPS on an SSD for $5 a month is great
    but are you going to stick your DNS server, database server, email server and web server on there? Also as soon as you get much traffic you are going to wish you had a heap more resources. A well specced and uncrowded shared host with separate email, database servers will provide you with far better performance.
    Also remember your VPS is on shared hardware, just like your shared hosting. You also mention ‘calling yourself a developer, you should never use shared hosts’. As a developer the last thing you want to be worrying about is setting up your server, security, server performance. These kind of sweeping statements are no better the piles of rubbish code on the web that many people above mention. As a commentator in a position where people listen I think such narrow views are a bit irresponsible. By the way we also run the current stable PHP 5.5.9 and will be offering 5.6 when it is out, darn these shared hosts who are up to date! ;-)

    • Who is “we”?

      I agree with most of what you said here, perhaps I was a bit too generalist, but it’s not just about performance – it’s about extensibility. Custom extensions especially – until there’s a shared host that can support building and installing them per-user, I can’t consider it a serious development/deployment environment.

  • OctavianNita

    Hi Bruno,

    I mostly agree with all your points but i wouldn’t consider the version of a language/environment very relevant these days… Sure, using v. 0.10.x in production sounds strange but I remember reading things about php v. 3 that did not really qualify it as a language… (things like parsing errors, etc.) Yet lots of things got done. So, if by simply versioning some technology above 1.0 doesn’t make it stable or better, I’m thinking that neither versioning one below doesn’t necessarily make it unstable…

    Other than this, you’re right: this discussion could be like a template for many languages :)

  • kenoli6666

    I’d like to speak for the web developers like me who taught themselves php and find it a hugely useful language for the web sites I put together for my personal and small business use and for community groups and others I donate time to.

    It has allowed me to go beyond the confines of WordPress and other CMSs and create sites that do what we need them to do.

    For our work we don’t need a strongly typed language or a language that meets enterprise level demands.

    There have been security issues with php, but with PDO and other improvements the language certainly meets my needs.

    Every time I attempt to learn Objective C or even IOS programming, I am grateful to have the much more user friendly PHP available.

    I don’t know how many of “us” are out there, but I find it a breath of fresh air that php hangs in there in the spirit of the “everyone can do it” internet world as everything seems to be being taken over by the corporations and their “enterprise” demands.

    PHP for the people!


    PS — Some of us would appreciate if some of you would lighten up on the disparaging remarks about people like me who taught ourselves php. In the world of “corporations rule!” I think it is wonderful that “small” people still have access to important tools like the internet. We will probably be squeezed out completely some day, but not yet.

  • xlordt

    So much WP hating, unfortunately it does create bad habits… but sadly to say.. .some of us have to stick with it because its making some of us some good $$ (yes I do include m y self in this). :-)

  • Janusz Szcząchor

    I prefer to use PHP since its syntax is simple and intuitive. Besides, as a teacher of physics I do not have enough time to learn more complicated languages. I started to learn coding with Fortran, Basic and Pascal but PHP is enough good to write e.g. an aplication that solves quadratic equations and gives solutions without decimal expansion. I do not like CMS’ , its structure is too complicated to study it and insert some PHP scripts into.

  • Gary A Mort

    Why use PHP:

    PHP is Mature. Security hazards and bugs are very well known and addressed. Yes, it is quite possible to get bad code, but you can get bad code with any language. Considering that Ruby on Rails contained an SQL injection bug in one of the base classes used by almost every Rails project for over a year – EVERY rails website was easily hackable. Wheras with PHP you may very well run into an application with an unfixed exploitable security bug, I can’t recall the last time one was found in core PHP[yes, there have been so called “security” bugs based on random hashes not being ‘random’ enough…but those hacks are esoteric and unlikely].

    PHP is readable. I’ve run into lots of PHP websites where some secretary with a passing knowledge of html can edit the website because the PHP code is easy to ignore….note: using “good coding practices” can lead to code that is no longer readable, so there is a time and place for everything.

    As for using it from the command line – command line applications are not built for speed, PHP is fine on the command line. And in the end, using a single language can have major benefits. Compare Google and Facebook. As Google has grown, they have dabbled with just about every programming language – to the point now where they have to create over-complicated protocols[Protocol Buffer for example] in order to ensure that all their tools can communicate with each other. Facebook went to the other extreme and have focused on enhancing PHP internally. Both are highly successful companies, so there is no one right answer.

  • ashour

    I’m the sole web developer in a startup and we’re looking to hire more developers and, soon thereafter, rebuild our app (which currently is a clean prototype). I’ve been considering Ruby and RoR for the structure that RoR gives. I also have a personal slant towards Ruby. Reading your article got me thinking about learnability, however.

    Odds are we will hire college grads to save money and not worry so much about them unlearning ingrained bad coding habits. Ruby, while a beautiful language, is not as learnable as PHP, so the latter seems a better option for less experienced developers.

    Moreover, my startup is in the Middle East, a region that has much more PHP adoption than Ruby/RoR. If I’m looking at my hires’ needs, they’ll want a career in web development which may well not be spent entirely with my company. These developers will likely have a much easier time finding PHP jobs after they leave us than RoR jobs.

    So I’m not so sure about RoR anymore, and I’m seriously considering PHP/Laravel for my company’s server-side moving forward.

    • If you’re starting from scratch with people who have little to no experience, why not train them in something even better? Dart, for example, or if you want PHP, go for HHVM or Zephir, both cutting edge solutions slated to change the PHP world much more than Laravel.

      • ashour

        Well, the simple answer is that I don’t know Dart, HHVM, or Zephir. I will be transitioning from full-stack web developer to team lead/ux/designer. So I will need to be able to efficiently do code reviews with my team and guide them with the architecture and coding practices. I already know Laravel (3 mind you), so I feel the transition will be much smoother for me. If I had time, I would explore other alternatives, but startup life :/ :)

Get the latest in PHP, once a week, for free.