PHP 5.3 New Features

Article by Simon Hill (29,194 pts ) , published Dec 10, 2008

Here is a brief look at some of the new features in PHP 5.3 and what they mean for PHP developers.

PHP 5.3

PHP 5.3 offers a minor version update of PHP which includes some features that were planned for PHP 6 so it may be of interest to PHP developers. The current version released in December 2008 is the third Alpha version so the code is available to start experimenting with but you may not want to switch just yet.

The new code should improve stability and it introduces a range of new features.

Namespaces

Namespaces provide a way to help you to organize your code and by using the new namespace keyword you can avoid any user class issues or clashing. Namespacing allows two similarly named classes to coexist and solves the problem of long class names. You can also utilize the use keyword to define namespaces or import single classes to your file (the use keyword replaces import). You can also create aliases and access functions and constants. The _autoload function will now get the fully qualified class name so if you have used it you’ll have to modify.

Late Static Binding

This allows the parent class to use a static method and prevents it being overridden by a child class which was not previously default behaviour.

Dynamic Static Calls

This provides more flexibility by allowing you to have variable static calls.

MySQL Native Driver for PHP

This is a replacement library which has been developed and optimized for PHP. The new mysqlnd is easier to install and it is licensed under the PHP license. It should offer a number of advantages over libmysql including a lower memory footprint, faster performance and easy compilation and analysis with a range of available statistics. It can save huge amounts of memory by utilizing read only variables and looks to be a big improvement for PHP developers.

Improved INI Handling

You can now have “htaccess” style user defined php.ini files for CGI. The error reporting for the syntax in your php.ini files has been improved and ini variables can be used everywhere in php.ini files. There are quite a few improvements for anyone dealing with ini files.

Additional Improvements

There are some other improvements offered by PHP 5.3 such as Open ID support, XSLT profiling, Get option on any platform, error levels split, Sqlite3 support and a number of bug fixes.

 
Subscribe to Web Development
RSS
Get free weekly updates, directly to your inbox.
Browse Web Development