Yireo - Extensions, tutorials and blog for Magento and Joomla!

PHP 5.4 is upcoming

Monday, 21 November 2011

phpI hear you thinking: The move from PHP 4 to PHP 5 was dramatic and took over 6 years. But just PHP 5 was not good enough, because PHP 5.0.1 came out already long before PHP 4 was called obsolete. At this moment, PHP 5.3 is considered to be optimal, but software developers still seem to have trouble getting everything updated. And now, PHP 5.4 appears on the horizon. Time for another migration?

Features of PHP5.4

Just a couple of weeks ago, PHP 5.4 RC1 was released, which means a so-called stable version might appear in a few months. So, let's review the changes in PHP 5.4. There do not seem to be very dramatic changes, so that code can be migrated quckly. The biggest changes seem to be the addition of so-called traits (see below), some code-changes that require you to properly set the date.timezone in your PHP-settings (in other words, configuring date.timezone becomes required), a built-in command-line webserver (making testing a bit easier) and ofcourse numerous bugs are fixed.

A minor feature but very important when put into production, is that E_ALL now also includes E_STRICT. When PHP-servers are setup in a default way, this means that all PHP Notices and PHP Warnings will crash the page. It's pretty unforgiving to PHP-developers who should not make mistakes anymore, but it's actually one of the proccesses that make PHP 6 (not light-years anyway) more reliable.

No more Magic Quotes

While Magic Quotes have been obsolete (or deprecated) already for years, many hosting providers still have this setting enabled. Not knowing about the philosophies of this setting, they believe it is actually a good thing which is protecting their customers. Let the customer install unsafe PHP-code, which will be made safer by Magic Quotes being enabled. Well, in PHP 5.4, the setting is completely removed. So if hosters still don't get the point by now...

Traits instead of mixins

Those of you familiar with the Nooku Framework, might have heard about mixins - code constructs that make it possible for a subclass to inherit from multiple parent-classes. This multi-inheritance is useful when you have a lot of functionality, but you don't want to replicate too much code in too many classes, and it was not possible with PHP until now: Using traits, one single class can inherit from multiple parents. Very cool, but will it mean that Nooku Framework will rewrite all its mixins to traits? Probably not, because mixins also allows for some cool polymorphism tricks while traits do not.

Conclusion

Ofcourse, this is not all it. But we hope this blog gives a good impression on what's next in PHP-land. PHP 5.4 seems well the effort, and if you're a PHP OOP-developer, you certainly might want to jump into the cool new features. Let's just hope that all the hosting provider provide PHP 5.4 support soon.

Blog Tags

MageBridge Standard

About Yireo

Yireo tries to help webdevelopers build successful Joomla! and Magento sites.

More about Yireo