Monday, March 31, 2008

Object Oriented Features NeObject Oriented Features New To PHP 5w

PHP 3 was released in mid-1998. Some basic object-oriented (OO) capabilities were included, more or less as an afterthought, to “provide new ways of accessing arrays.” No significant changes were made to the object model when version 4 was released in mid-2000. The basics of objectoriented programming (OOP) were there-you could create a class and single inheritance was supported.

With the release of PHP 5 in 2004 there was plenty of room for improving PHP’s OO capabilities. At this point, Java, the most popular OO language to date, had already been around for almost 10 years. Why did it take PHP so long to become a full-fledged OO language? The short answer is because PHP is principally a web development language and the pressures of web development have only recently pushed it in this direction.

Support for objects has been grafted onto the language-you can choose to use objects or simply revert to procedural programming. That PHP is a hybrid language should be viewed as something positive, not as a disadvantage. There are some situations where you will simply want to insert a snippet of PHP and other situations where you will want to make use of its OO capabilities.

In some cases, an OO solution is the only solution. PHP 5 recognizes this fact and incorporates a full-blown object model, consolidating PHP’s position as the top server-side scripting language.


Access Modifiers
Built in Classes
Backward Compatibility
Where to Go from Here

No comments: