About the Author

author photo

Adam Trachtenberg is the Director of the LinkedIn Developer Network, where he oversees developer relations and marketing for the LinkedIn Platform. Before LinkedIn, Adam worked at eBay in platform product management and marketing. Even earlier, he co-founded Student.Com and TVGrid.com. Adam is the author of PHP Cookbook and Upgrading to PHP 5. He lives in San Francisco.

See All Posts by This Author

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?

Comments are closed.