🤯 50% Off! 700+ courses, assessments, and books

PHP 5.1’s Killer Feature?

    Kevin Yank

    PHP 4 didn’t really catch fire in terms of real-world server support until its first major update, version 4.1. Will the same be true of PHP 5, the first point release of which is now in its early beta stages?

    PHP 5.1 Beta 1 has been out for ten days, and Beta 2 has just become available. Neither of these releases has yet been announced on php.net, nor has an official list of changes been posted, but if you’re especially curious you can read the detailed breakdown maintained by the developers.

    Upon its release in early 2002, PHP 4.1 made some important changes to the language. It was the first release that recommended register_globals be switched off to improve security. The long-named variables like $HTTP_GET_VARS for accessing submitted values securely were replaced with shorter, more convenient superglobal variables like $_GET. All up, PHP 4.1 almost had a greater impact on the way developers used PHP than the major 4.0 release did.

    At this stage, PHP 5.1 is not looking to be quite as spectacular. Some enhancements to Perl regular expressions, a few extra array functions… nothing to write home about. But there is one significant enhancement to PHP in 5.1: PHP Data Objects (PDO).

    The PDO library lets you access any of an extensive selection of supported databases using a signle set of functions. So not only do you only need to learn one set of functions to write for multiple databases, but you can transition an application to another database without having to change all the functions throughout your code.

    PHP developers have been achieving this for years using database abstraction layers, at first homegrown, then open source, and finally official. This is the first time such an abstraction layer will be completely built into PHP, and not a layer of PHP code sitting on top of it, however.

    Could this be the killer feature that draws developers to PHP 5.1 when real-world adoption of PHP 5 is still lagging? If you feel like trying out PDO to decide for yourself, a good place to start is the lead developer’s blog.