When I started writing PHP...

in #php6 years ago

I don't know exactly when I started writing PHP. It was shortly after the start of my second quarter of my freshman year of college, when a newly-met friend of mine introduced me to PHP as an easier to understand alternative to Perl. That puts it, I think, somewhere in January or February of 1999.

20 years ago, give or take a week. I have been writing PHP for two decades. That's more than half my lifetime. I feel old.

I thought it would be amusing (mostly at my expense) to look back a bit on just how much the PHP world has changed in the last two decades.

When I started writing PHP:

  • Our code files ended with .php3, to differentiate them from the older .phpfi.
  • PHP existed only as mod_php for Apache. That was the only web server that it ran on. Or that mattered, really.
  • register_globals was not only still a thing, it was considered a best practice.
  • The PHP engine (it wasn't even called the Zend Engine yet; Zend didn't exist) didn't do any pre-compilation. It interpreted every statement in a file one at a time, executed it, and then discarded it. That meant the same line inside a loop would get re-interpreted on every loop iteration.
  • No one in PHP knew what prepared statements were. (OK, I'm sure someone did, but the zeitgeist didn't, and they weren't even possible to write yet, natively.)
  • Instead, we had addslashes(). And we were happy to have it!
  • We also has magic_quotes, which automatically ran addslashes() on all incoming input. The combination of magic_quotes with addslashes() (and its doppleganger stripslashes()) led to some very... interesting code from certain junior developers who didn't know how to configure their server, let me tell you...
  • PHP still didn't have classes. At all. The class keyword didn't exist. And let's not even talk about anonymous functions.
  • PHP had no native session functionality. If you wanted to manage user login or state, you got to set your own cookies yourself.
  • Uploading individual files to production over FTP was considered a best practice; the alternative was to edit directly on the server. (That was already wrong at the time. It still is. Don't @ me.)
  • My editor of choice for pretty much all code was Nano. It would be a few years before I figured out how to turn off hard-word-wrapping in it...
  • Most developers didn't know what version control is. Of course, the options at the time were RCS and CVS, so maybe that's understandable.
  • Variable variables were considered good practice. Or at least, not a bad practice. (They are a bad practice. Don't @ me.)
  • Template engines were a thing you wrote yourself. Assuming you used one at all. Putting PHP inline into HTML and inserting random include() statements was still how the pros did it.
  • No variable could be type hinted, anywhere. If you cared about type, you had to check yourself with is_*() functions. Most people didn't. Lots of SQL injections happened that way.
  • There was no way to share code. Everyone wrote everything from scratch, or if you were really progressive you copied and pasted random code off of a blog you found on Web Crawler. That's how you knew you were being efficient.
  • Although they weren't called "blogs" yet. Those didn't exist for a few more years, although personal websites (mostly running either PHP or GeoCities) were already a thing.
  • The release schedule for 3.0.x was "when Rasmus felt like it."
  • The running joke "you're not a real PHP developer until you've written your own CMS and discarded it" wasn't a joke yet. It was just becoming reality, but it wasn't old enough yet to be a joke. (Yes, I wrote my own CMS and discarded it.)

And this was still an amazing leap over PHP/FI that came before it. :-)

Here's to the next 20 years, PHP!

Sort:  

I came to PHP just a bit before that from doing everything with server-side includes and Cold Fusion. I still have the source code for my old website with a bunch of .shtml files.

It's fun looking back at the things that were awesome before they were terrible. I remember thinking that ADODB was a pretty sweet database layer that would let me change from one database to another. Then PDO came around. I've still never moved a project from one database to another.

Ha! Yeah, the DB portability argument has been around forever and it's still not really a thing.

Another one I forgot: It was considered good practice to tweak your Apache config so that all .html files were processed as PHP, to hide the fact that you were using PHP. Because security through obscurity, yo!

Wow, I think I started a long time ago, jejeeje, 2005 to be exact.