Archive for September, 2004

Writing for PHP 4 and PHP 5

A few weeks ago, John Lim kindly reviewed Upgrading to PHP 5. Overall, I was very happy with his comments, particularly when he said:

Even though I have read widely about PHP5, I still found this book a useful reference, because it delves deeper into the new features than most articles I have seen.

There’s a lot of free PHP 5 material, and I was a little worried that people wouldn’t find anything new in the book. It’s a good sign if John, who reads widely on PHP 5, learns something.

He also had one critique: that I didn’t spend enough time covering how to port code from PHP 4 to PHP 5. At first, this surprised me, as I specifically provide both PHP 4 and PHP 5 code examples.

Then I realized our PHP migration experiences are totally different. When I moved to a new version (and I’ve made many, as I started PHP programming with PHP/FI, aka PHP 2), I ported internal applications. I didn’t worry about other people running my code.

In contrast, John writes ADODB. This is an external application. He’s not writing for his personal or corporate use. He’s writing for everyone and anyone.

I could control my environment. While I know people would be running under shared hosts, I figured they could at least control whether they’re using PHP 4 or PHP 5.

John, however, doesn’t have that luxury. He needs to write code that can run under both PHP 4 and PHP 5. That’s why he wants me to discuss “features such as PHP_VERSION, phpversion(), extension_loaded(), function_exists(). I don’t cover that at all.

If you need these this, I guess you’ll have to wait for the second edition. :) However, I think if I was in this situation, I’d create a separate PHP 5 branch. There are so many PHP 5 specific features that just don’t play well with PHP 4, and I wouldn’t want to limit myself.

I’m interesting in hearing what other people are doing. I’ve only been following the PEAR folks a little bit. How has this been playing out?

Rosh Hashana Humor

Funniest Rosh Hashana joke ever…

MySQL ComCon Europe 2004

I just heard about MySQL ComCon Europe 2004. It looks really cool. It’s a whole three-day MySQL conference going on in parallel with the International PHP Conference. (Same dates, same hotel.)

All the speakers are MySQL employees, so I’m betting most (if not all) of the sessions are being presented by the actual programmer who implemented the feature. For instance, Georg Richter wrote the new PHP 5 mysqli extension, and he’s giving a two talks on exactly that. There are also a few talks on all the new MySQL 4.1 and 5.0 features, such as views and stored procedures. If you haven’t checked out MySQL in a while, they’re adding features like crazy.

I’ve been going back and forth whether I want to fly all the way from San Francisco to Frankfurt two weeks before I’m going to Las Vegas for ApacheCon. I was hoping to convince the International PHP Conference folks to let me talk, but that didn’t work out. If that had happened, I definitely would have gone. :)

It was a tough call when it was just the International PHP Conference, but now that the MySQL ComCon Europe is also there, it’s become even harder. Hum… Maybe I’ll go price flights again.