PHP: The Good, The Bad, The Ugly

So I want to talk about my first true love in programming, PHP. If you're a developer, it's about to get controversial. Otherwise, hopefully, I can get to you before the nay-sayers do.

The Good

PHP is a pretty damn amazing language if you ask me. It's meant for one thing, and it honestly does it better than anything else. What is that thing?

Dynamic Web Stuff

This can be anything ranging from a basic-to-advanced WordPress website [insert shameless self-promotion here built by your favorite (Red Shark) Digital Agency, to a full-powered software level web-based application for managing all kinds of data/tasks/whatever you want really. But it's not the only thing that does these kinds of jobs (well, WordPress is PHP only, but we'll get into that again in a bit), far from it. So let's see how it stacks up, from a high-level view, of the other tools to be used for this kind of production.

Java is a super popular, and equally powerful, programming language that can be used not only on the web but on desktops for downloadable software applications. It's extremely well-liked among a lot of enterprise level corporations, and for good reason. It has an incredible track record, plenty of history, and tons of documentation. Mix it with some other open source platforms, and you'll be able to run java on your servers for a fairly reasonable price. It's also a language I'm really interested in picking up soon. Next.

C# is, for what we're discussing, the same as Java. It can be used on desktop as well as web, extremely popular, you get it. Consider it Java but for Windows and better (for Windows-based stuff anyways). As a Linux fanboy, I have no interest in learning C#, but I have to put my bias-ism aside and admit that it's a great language. Still, it is worth mentioning that C# development can be fairly costly when it comes to getting into larger projects. So if you're a startup, I'd maybe consider something else (like PHP).

Python is, well you should know how I feel about python by now. And if you don't, it's really your fault. Python is a scripting language, unlike the previous two mentioned, and can be used to build powerful web applications using super useful frameworks. It's also getting very, very popular with startups to use for web software. It's a heavy contender, no doubt due to its easy-to-read syntax and low learning curve. Even organizations as big as NASA use Python (as well as other languages) and it was the go-to choice for Google during their early days.

Ruby is much like python in this regard. A scripting language that uses frameworks, etc. Lot of similarities. It's most commonly used for web development using the "Rails" framework, and it's nothing to take lightly. Ruby on Rails can be a powerhouse, but it can also have its issues. Remember the Twitter "Fail Whale"? Well, that was, at least in part, due to Ruby. The popularity has also started to die off and some of the fad developers have moved on to Python or even Javascript for back-end development, or just going straight for the enterprise level languages like Java or C#. That's not to say that the language is dying, however.

So yeah, all of these can be used in place of PHP for the most part, but with one HUGE assumption. All of these languages need additional work to get them running. While the same can be said for PHP, it's extremely easy to set up. And pretty much every web server you will ever come across, it'll run PHP out of the gate. It's a capable, reliable language that runs everywhere. That's why it's so popular with freelance web developers. It takes the fewest assumptions to get up and running, with (almost) all the same benefits (effectively) of the other options with fewer (if any) things needed to get it off the ground and be able to do pretty much all of the same things, albeit in a different way. But the other languages, you'll need to install them, set them up to work with a directory, often installing a number of dependencies, templating engines to make the output HTML, the whole nine yards. This can be an extremely tedious task, especially if you just want to get up and running.

PHP was built specifically for the web, and it's, in my opinion, almost impossible to beat at its own game.

The Bad

I'm honestly hard pressed to think of anything that is objectively wrong with PHP. A lot of developers like to hate on it because of how forgiving it is. PHP is easy, which can also be a downside. Because of its ease to learn, and how forgiving it can be with errors, this has lead to a lot of terrible code being written with the language over the years. This can be extremely frustrating to deal with, as things can occasionally need to be rewritten entirely from the ground up if the application is bad enough. But this isn't to the fault of the language, just the developers.

Another downside and this is just me trying to not be so one-sided, is PHP won't run outside of a server. It's not meant to, so don't fault it. But if you're already a seasoned Java/C# developer, I wouldn't expect you to learn a new language just for one project. Chances are, you already have the dev-ops knowledge to get your ecosystem up and running.

The Ugly

PHP as a whole can be a little bit of a mess in its syntax for people who come from other languages. From the way it handles OOP principles to the different arrow operators, the lack of dot ( . ) notation, and so on, it can be a little bit of a culture shock. Still, that doesn't make it a bad language. There are also some other issues with the language from the early days, but the language has matured extremely well over the last few years.

Conclusion

The bottom line is this: PHP is a fantastic language that will get your website or web application running in no time. You may have to get a little creative at times, but there's nothing web-wise you won't be able to accomplish with it. It'll run on the cheapest of servers, it won't take you as long to learn, and you'll be up and running in no time.