Browse DevX
Sign up for e-mail newsletters from DevX


The Object-Oriented Evolution of PHP  : Page 4

One of the key ingredients in the upcoming version 5 of PHP will be the Zend Engine 2.0, with support for a brand new object-oriented programming model. This article describes the evolution of the object-oriented programming support in PHP, covering the new features and changes that are scheduled for PHP 5.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

What Else Is New?
As one might expect, the Zend Engine 2 packs in quite a few other features along with its brand new object model. Some of the features further enhance object-oriented capabilities, such as private member variables and methods, static variables and language-level aggregation. Most notable is the revolutionized interaction with external component models, such as Java, COM/DCOM and .NET via overloading. PHP 4.0 was the first version to introduce this sort of integration, but the new implementation is much quicker, more complete, more reliable and far easier to maintain and extend. These elements mean that PHP 5.0 will play very nicely in your existing Java or .NET based setup. You'll be able to use your existing components inside PHP transparently, as if they were regular PHP objects. Unlike PHP 4.0, which had a special implementation for such overloaded objects, PHP 5.0 uses the same interface for all objects, including native PHP objects. This feature ensures that PHP objects and overloaded objects behave in exactly the same way.

Finally, the Zend Engine 2 also adds exception handling to PHP. To date, the sad reality is that most developers write code that does not handle error situations gracefully. It's not uncommon to see sites that spit out cryptic database errors to your browser, rather than displaying a more user-friendly "An error has occurred" message. A key reason for this is that handling error situations with the versions of PHP was a daunting task—you actually had to check the return value of each and every function. Adding a set_error_handler() function made managing errors slightly easier, —but still left a lot to be desired. Adding exception handling to PHP lets developers achieve fine-grained error recovery, but more importantly, it facilitates graceful application-wide error recovery. The release of PHP 5.0, powered by the Zend Engine 2.0, will mark a significant step forward in PHP's evolution as one of the key Web platforms in the world today. While keeping its firm commitment to users who prefer using the functional structured syntax of PHP, the new version will provide a giant leap ahead for those who are interested in its object oriented capabilities—especially for companies developing large scale applications.

Zeev Suraski has been working for over five years on the PHP project. Along with Andi Gutmans, he started the PHP 3 and 4 projects and wrote most of their infrastructure and core components, thereby helping to forge PHP as we know it today and attracting many more developers to join the movement. Zeev is a co-founder and CTO of Zend Technologies Ltd, the leading provider of development and performance management tools for PHP-enabled enterprises. You can reach Zeev through Zend's Web site at www.zend.com.
Thanks for your registration, follow us on our social networks to keep up-to-date