Tagging along with PHP – A journey from 1998 until today
When PHP3 popped up, it was here to stay
In 1998 I began my long winding road towards becoming a web developer. I had just discovered the joy of creating and designing web sites. Showcasing for the entire world (see: modem people) watch the abominations of my early web designs.
As a student, a friend of mine showed me some web-scripting in Perl he had been working on. I was very impressed with what he had done; web pages that could process information via forms, like programs! I started (with baby-steps) getting into Perl, writing the typical “hello world” programs.
Not long after the introduction in web scripting, PHP3 had become the hot new scripting language for the web. And to be honest I don’t think it had much of a competition. The most common alternatives at this time were either PERL or ASP. ASP needed an IIS server and a morbid interest in VBScript and PERL which looked as gooey soup of regular expressions. So PHP was the most compelling choice for most beginners.
With me, a lot of people started their PHP developing path during period of time. The syntax looked pretty much like C, which I were familiar with. For me, it was indeed the most accessible and easy language to pick up for web-scripting.
In my old boy room, I booted up my 486 Linux Slackware machine and downloaded/compiled and installed Apache, MySQL and PHP3 and after a couple of days I’d beefed up my personal web page with something such as exciting as a guest book and “number of visitors” counters. At this time it was very important to put on display how few visitors the web page had, for the few visitors that ever visited. All in a few HTML/PHP messy files.
PHP4 and the new millennium
In May 2000, PHP version 4 came out. With it, a lot of important projects came to life such as Drupal, WordPress and MediaWiki, to name a few.
The biggest changes from version 3:
- Rudimentary OOP support
- Super globals $_GET, $_POST, $_SESSION etc.
- A new interpreter Zend
Around the beginning of new millenium, PHP was certainly top of the line. The popularity had skyrocketed. People that new some basic scripting skills could put their ideas into working online solutions very fast. More and more companies became interested dynamic web solutions and were willing to pay developers to produce solutions for them. PHP gave the developers all the tools to practically create any kind of online system just from an idea and basic programming knowledge.
However, a lot of code that were produced in the first half of the last decade were written by inexperienced developers. Who created their very own programming styles and programming designs. This resulted in code that was impossible to maintain. It was terribly hard to read other people’s code, and the soup of HTML mixed code didn’t exactly help. The worst I’ve seen was a web application relied on an array with five dimensions.
People were practically sitting on needles when their bosses told them that they’d just inherited someone else’s code. Most of the time it felt like untangle a kilometer of fish line. To be honest I also wrote a lot of “frankensteiners” in the beginning, which still brings me bad conscience of what I’ve left behind to someone else’s misery.
At this moment of time, developers started looking elsewhere. Some developers headed towards more stricter languages, that had implemented coding frameworks which implemented design patterns and smart ways structuring code.
In 2004 PHP5 was released, which offered a lot of improvements. The OOP support had been pretty much re-written and it could now match and compete with more “professional/enterprise” programming languages.
Still PHP5 didn’t revolutionize the community as it could have. Maybe because people didn’t bother to upgrade and break their existing solutions. And I sincerely think OOP was still quite a new and unknown way of coding amongst PHP developers.
Around 2005, the competition with other languages was catching on. Two very popular and today known frameworks were released 2005. One of them were Ruby on Rails and the other were Django. Many “know-it-all” developers compared the new PHP against Frameworks made in Python, Ruby and C#. It’s a comparison that weren’t very fair since it compared a scripting language against a custom made frameworks. Frameworks which enforced the programmer into a certain structure and coding style. Yet it’s true that PHP also were blessed with a variety of frameworks at this time such as Symfony (2005), CakePHP(2005), CodeIgniter (2005) and Zend Framework (2006). But they weren’t much mentioned in the comparisons.
PHP today – It isn’t bad (In fact it’s pretty awesome)
A lot has happened since PHP5 came out (10 years ago). If you want PHP can be as OOP:ish as you would like. Much care has taken into account to update the language to meet the competition in modern scripting languages such as:
- Anonymous functions
- PDO – Wrapper for all types of database using statements
- A huge improvement in object oriented programming supporting reflections, interfaces
With > PHP 5.4 you don’t need to setup a web server to do PHP development. Use a SQLite database (file based) and make use of the built-in web server in PHP and voila! You’ve got a pretty portable develop environment. Use one of the many ORM frameworks that exists and your migration between database to database will be an easy task.
There is an ongoing rebirth in the PHP community, with frameworks like Symfony2, Laravel. Developers who are on a mission to prove that you can write maintainable reusable code whilst creating amazing web solutions. PHP also got it’s new package system called composer through avid PHP developers.
I personally must say that I love the object oriented implementation in PHP5. It has matured in an exceptional way. It provides tools to enable you to write beautiful, robust code in an MVC way, in order to separate the data, logic and presentation. I dare to say it is as good as any of its web language competitors. It is still down to the fact that there are developers that write good tested code, and developers that doesn’t. The freedom in PHP brings these type of developers together, and there is lots to learn.
I still feel that there are a few things missing in PHP. There are still a lot of functions that are directly inherited from C, such as strcmp, strlen and fopen for example. A lot of frameworks use wrappers around these rudimentary functions, to make them more easy and safe to use as they throw catch-able exceptions instead of errors.
I also wish the possibility to type hint more in the language (which of course should be optional). Like contents in an array and return values. I love the loose dynamic typing in PHP, but in some cases I wish you could enforce the interpreter to be more strict.
Again the error handling, I would much more prefer it would work more like Java, where you can catch errors and handle them instead of writing routines for catching errors or exceptions.
I have had a long relationship with PHP that’s been lasting for over 16 years, which is… sadly longer than any relationship I ever had. PHP has been my weapon of choice approaching different problems in the field of web development, and many other uses. Sometimes it might not been the best choice, but it always made me finished the job and made people/clients happy. I still believe PHP is the best language for rapid and stable web development, but if you’ve came this far down in the article you might have guessed that I’m fairly biased.End note: Nothing bad meant about Perl. It’s done a great job in a lot of different situations. I’ve just never gotten my head around it.