Is PHP Truly A Bad Language To Write In?

November 9th, 2012 Leave a comment 3 comments
Like the article?
Is PHP Truly A Bad Language To Write In

Despite it being 2012 and the PHP wars having been waged for years now, many people still continue to rail against PHP as a programming language. The complaints about it are numerous, and many of them are warranted to some extent: non-standard function names, exceptions to operator usage, and non-standard inheritance of ideas from other languages are just a few of the legitimate complaints that come out of the anti-PHP camp. Many of them, however, curiously seem to center around one core complaint: that it leads programmers to write “bad code”, either because of the reasons listed above or because of others.

The complaint is, on the surface, quite an attractive one: PHP’s perceived failings are leading to programmers who use it writing bad code precisely because it’s not giving them the structure or regularity needed to write good code. If anything, however, the opposite could be said to be true: programmers are writing good code in PHP despite PHP’s perceived failings. Large websites like Facebook are written in PHP, and they work both without bugs and quickly to boot. Likewise, WordPress and Joomla are both great examples of solid, well-written code in PHP. The language, then, seems to have no bearing on how programmers write code. The burden of good code writing lies, as it always has, on the programmer.

But what about the other problems, such as the ones listed above? Those still exist, whether programmers are writing good code or not, and ostensibly they should be preventing programmers from writing the best code they could. Are they?

The answer might surprise you. The answer is… it doesn’t matter. Not a whole lot, at least.

How could it not matter? Well, it’s simple- being the best-designed language was never what PHP was meant to be about. PHP was meant to be a programming language for non-programmers that was easy to pick up and use for simple projects. In that regard, it’s succeeded wildly. PHP is being used in websites from small to large, from the aforementioned Facebook to little custom blogs all around the web. PHP’s appeal lies there, and it’s exploded to such an extent that it’s ubiquitous. And that very same ubiquity means there’s an impressively large support network of third-party modules, help forums, and more for any PHP programmer looking to get their feet wet and having trouble getting their PHP scripts to run.

Some might say that doesn’t matter, and that we shouldn’t be using a language with problems in the first place. Maybe that’s true- but it’s working, and it’s working well. PHP is continually being improved, and it seems as though the developers are accepting criticism and working to help PHP become better as a result. Meanwhile, the large support community means that breaking into PHP is getting easier and easier, with more documentation and more tutorials popping up every day.

Maybe Python is a better language. Maybe Rails is a better language. That’s not exactly the issue here, however: the fact of the matter is that even if PHP isn’t the better language, it’s a good language for the job because it works while also already having a great support community around it. It’s a good language because it’s easy to break into. In short, it’s a good language because it’s for non-programmers who work with the Web- precisely the kind of web programmer that’s driving website creation.

Is PHP a bad language to write in? For some, perhaps. But for me and millions of others, it’s a great language that does what we need it to do with a large community that offers us features and support we never dreamed possible, and for that alone it’s most definitely a language worth writing in!

Help us spread the word!
  • Twitter
  • Facebook
  • LinkedIn
  • Pinterest
  • Delicious
  • DZone
  • Reddit
  • Sphinn
  • StumbleUpon
  • Google Plus
  • RSS
  • Email
  • Print
If you liked this article, consider enrolling in one of these related courses:
Don't miss another post! Receive updates via email!

3 comments

  1. Php was designed for web development. About 75% of Internet is done in Php according to http://w3techs.com.

    For a while it was thought that Ruby on Rails was the cure for cancer and now all the buzz is over, Twitter dumped it.

    “Bad code” can be written in every language but as you said there are great open source projects written in PHP like WordPress & Symfony2 just to name a few.

    So if you want to build something small & fast or you want to build something more reliable you can always choose PHP.

  2. droope says:

    It’s interesting. I coded in PHP and I find it to be good if used well.

    All in all, bashing PHP is a fashion. The fashion of 3 years from now might be bashing Python.

  3. Toddrun says:

    PHP is cheap and readily available too – you can’t beat the hosting options. It’s almost the commodity language of the web for server side processing. There are some things I hate about PHP, yet I use it for some projects because the level of entry is so low. Like any language, PHP is a tool, and when you need a quick, easy, cheap tool, PHP is great. If you don’t like it, don’t use it!

Comment