The PHP Culture

Culture is not something that is usually associated with a programming language, but looking at the culture of PHP will help you understand PHP's implementation of OOP. PHP is an open-source language created more than 10 years ago by Rasmus Lerdorf. It has all the hallmarks of a successful open-source project: It has been around for a number of years, it is continually being upgraded, it has a robust developer community, and it has continuity of leadership—Rasmus Lerdorf still takes a very active role in its development.

PHP is by far the most popular web development language, and the major reason for its success is ease of use. This is no accident. It is easy to use because it was conceived as a language to simplify web development.[*] This has not been forgotten with PHP's upgrade to a full-blown OO language. For example, one of the new classes introduced in PHP 5 is the aptly named SimpleXMLElement. With this class you can incorporate an RSS feed into a web page using only four lines of code (see Chapter 12).

[*] See Rasmus Lerdorf, "Do You PHP?" available at www.oracle.com/technology/pub/articles/php_experts/rasmus_php.html. (Accessed March 14, 2006.)

The point of object orientation in PHP is not to turn PHP into Java or something similar, but to provide the proper tools for web developers. Object orientation is another strategy for adapting to the current circumstances of web development.


Note:

The impetus to "Keep It Simple, Stupid" is alive and well (and, as it happens, living in Paris). At a recent meeting of PHP core developers, the introduction of a new keyword was rejected as "against the KISS approach of PHP" (minutes, PHP Developers Meeting, Paris, November 11 and 12, 2005).


Unquestionably, there will be a learning curve for a procedural programmer adopting an OO approach to web development, but you'll quickly pick up on PHP's implementation of OOP. In fact, you'll probably find that some of the tasks you're used to doing procedurally are more easily done in an OO manner. I suspect that once you've started on the OO path, you'll find more and more uses for it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.135.224