The PHP5 Object Model

Published on January 25, 2009 by Mr nCoded   ·   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.

Tags:  , , , ,

Readers Comments (0)

Comments are closed.

Share & Review
Share

Review http://www.ncoded.com on alexa.com
Advertisment
Popular Articles
KingsCollegeChapelWest

Cambridge SEO, SEM & Web Marketing

With the Universtiy of Cambridge being on ...
seo1

2011 SEO Strategy using automated tools

After the massive response to my first ...
Social SEO Media

SEO Analysis of Amplify, Ping.fm, and Posterous

Most organisations spend time and effort on ...
danger

Bad Bad Web Techniques

OK it has been a long time ...
fishing_man

The Fisherman SEO Analogy

This used to be the main analogy ...
blogcomments

Blog Comments SEO

It would seem strange that most website ...
wp

WordPress SEO

Wordpress offers owners key requirements for SEO, ...
an

Setting up Google Analytics

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