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!
If you liked this article, consider enrolling in one of these related courses:
|Aug 18-19||Web Development with PHP/MySQL|
|- Classroom - Online|