Techno WeBlog

blogging about tech, the tech, and everything tech, for techno addicts!

Join Techno Google group

Taking a look at PHP 6

Nowadays in PHP world, the "noise" is about upcoming PHP6.
While most web hosts are still in the PHP 4 era, the PHP developers are already planning and working on PHP 6. Let's have a look at what's been keeping them busy.

Unicode support
When you're creating a website, you hardly have to think about the character encoding. You only have to decide how you tell the user agent what encoding you're using, but with a little help of Apache's .htaccess file, you only have to make that decision once. However, if you're building an application, the character encoding might become a problem. That's where PHP's new Unicode support comes in handy. With its support, PHP can automatically encode and decode the in and output of the script making sure both the database and the user agent receive the encoding they need without the need of any extra functions for the encoding conversion.

The big cleanup
PHP is already being used for a long time, creating a big user base, but also a lot of bad habits. Bad habits often result in slow scripts or even security holes. But these bad habits are not always the cause of the developer. Of course, he (lets just assume we're dealing with a stereotype developer here for simplicity's sake) is the one who's using it in his application, but sometimes the developer is not even aware he's using it.

Of course, the register_globals, magic_quotes and safe_mode functions. These three functions are hell for every PHP programmer so I'm sure everyone will be happy to hear that these functions will disappear in PHP 6.

In other related cleanup news, register_long_arrays and the long versions of the super globals like $HTTP_COOKIE_VARS are also gone in PHP 6. Same goes for zend.ze1_compatibility_mode which dealt with the backwards compatibility of PHP 5 classes.

Alternative PHP Cache
Caching is a very good way to improve the performance of an application. That's why there was a large demand for a good opcode cache in the default distribution of PHP. And when there's a demand, there's probably also a person or a group to meet that demand. The result is APC: Alternative PHP Cache. Of course, APC was already available a long time ago (01-07-2003), but the PHP developers have decided to include this extension in the core as the default caching framework.

OO Functionality
The improved OO model was probably the biggest improvement to PHP in version 5.0. PHP 6 tries to improve this even further by adding namespaces. If you're familiar with XML's namespaces or maybe C++', you will probably have an idea of how namespaces work. If not: Namespaces can group variables, functions or objects under a certain name. This allows the developer to use the same name for a variable, function or object multiple times. In case you'd like to learn more about the possibilities of namespaces, I find this C++ tutorial about namespaces quite useful.

Changes to the extensions
PHP is basically a collection of extensions which are all put together to form what we have now. However, these extensions change and so does the collection. Take, for instance, the XML Writer extension. A great extension to write XML files. Its brother, XML Reader, was already added and enabled in the core distribution in PHP 5.1, and now XML Writer will follow its example in PHP 6, forming a great duo to easily work with XML files.

Another change in the core distribution is the removal of the ereg regular expressions library which is going to be made an extension. ereg is currently used as an competitor of PCRE (preg_match, etc.), but apparently it's causing some problems. Therefore, the developers decided to remove it from the core and make it an extension.

Yet another change we see is the Fileinfo extension which will be dealing with media type detection. At the moment, media type detection isn't very good in PHP. We have the mime_magic extension, but that isn't really reliable. So in PHP 6, the Fileinfo extension will take over mime_magic's place and become part of the core while mime_magic will be moved from the core and made into an extension.

So we've seen quite some interesting changes so far. To me, PHP 6 doesn't really look like a massive feature update, but more as a big cleanup while improving a lot of existing functions along the way. And I think that's good! I'm working with PHP on an almost daily basis and looking at the things noted above, I'm only seeing improvements. So hopefully developers of popular applications like phpBB will make their applications work properly on PHP 5 making it easier for web hosts to switch their servers to PHP 5. But at the current state of PHP 5 support, I don't see PHP 6 becoming widely adopted if it were released today. So hopefully this will change by the time PHP 6 will be released.

More references:

1.) http://jero.net/articles/php6

2.) http://php.net/~derick/meeting-notes.html

3.) http://wiki.cc/php/PHP6

posted by Jansan John @ 12:38 AM,
Labels : DiggIt!  |   Del.icio.us


1 Comments:

At 7:31 PM, Blogger Binny V A said...

Hi Jansan,

Please link those URLs. Especially this one...

"In case you'd like to learn more about the possibilities of namespaces, I find this C++ tutorial about namespaces quite useful."

Thanks.

 

Post a Comment

Links to this post:

Create a Link

<< Home

Google

Archives

Previous Posts

Links