Chapter 10. PHP 5.3 Good Parts

PHP 5.3 was released in June 2009. It was a long time in the making and there are quite a few improvements and additions to PHP in this release. Some of the additions to the language were meant for version 6, but since version 6 seemed to be taking a while to come together, it was decided to release the features that were already complete and buy a little more time for version 6 as an added bonus. This chapter will briefly discuss some of the best improvements version 5.3 has to offer.

There was a cornucopia (I have always wanted to use that word in a book, too) of enhancements made to PHP 5.3. Since these enhancements cover the entire PHP product spectrum, we will jump around to a few different concepts here. For example, namespaces primarily affect the object-oriented aspects of PHP while NOWDOC affects management and display of strings. If any of these topics seems confusing, please refer back to earlier sections of the book.

Namespaces

Namespaces are meant to help with potential naming clashes within different object-oriented and function libraries that may be in use within a single development project. You may have libraries from outside sources and libraries that you develop yourself, and two or more of these libraries may have similarly named classes or functions. You might have a PDF-generation library and an email-generation library, both with a function named Generate. Without a whole lot of customization programming (and how do you decide ...

Get PHP: The Good Parts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.