The PHP5 Object Model

Published on January 25, 2009 by admin   ·   No Comments

Object handling was completely rewritten for PHP 5, expanding the feature set and enhancing performance. In previous versions of PHP, objects were handled like primitive types. The drawback of this method was that the whole object was copied when a variable was assigned or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value.

PHP 5 introduced private and protected member variables and methods, along with abstract classes and final classes as well as abstract methods and final methods. It also introduced a standard way of declaring constructors and destructors, similar to that of other object-oriented languages such as C++, and a standard exception handling model.

Furthermore, PHP 5 added interfaces and allowed for multiple interfaces to be implemented. There are special interfaces that allow objects to interact with the runtime system. Objects implementing ArrayAccess can be used with array syntax and objects implementing Iterator or IteratorAggregate can be used with the foreach language construct. There is no virtual table feature in the engine, so static variables are bound with a name instead of a reference at compile time.

Readers Comments (0)

Comments are closed.

Popular Articles

Bad Bad Web Techniques

list of bad web techniques that hurt ...

The 10 Facets of SEO

article about 10 key areas in seo.

Blog Comments SEO

article about the use of blogs and ...

OSCommerce SEO

There are various ways that you can ...

Wordpress SEO

Wordpress offers owners key requirements for SEO, ...

Setting up Google Analytics

[caption id="" align="aligncenter" width="500" caption="Screenshot of Google ...
Recent Articles
Advertisments