[ Team LiB ] Previous Section Next Section

What's New in PHP 5

PHP 5 introduces numerous new features that will make the programmer's life more interesting. Let's take a quick look at some of them. If they don't make sense to you now, don't worry, we cover all these features in detail in this book:

  • PHP has new integrated for support for XML. The various functions and classes provided to handle XML in different ways all now use the same underlying library (libxml2). This should make XML features more stable and interoperable.

  • The SQLite SQL library is now bundled with PHP, together with all the functions you need to work with it.

  • PHP now supports private and protected methods and properties in classes.

  • PHP supports class constants.

  • Objects passed to functions and methods are now passed by reference. That is, a reference to an object is passed around your script rather than copies of objects. This significantly reduces the likelihood of bugs in object-oriented code.

  • PHP supports static methods and properties, making more advanced object-oriented designs possible.

  • Methods can now be declared to require particular object types.

  • The comparison operator (===) now checks that two references point to the same object. Previously, it was hard to test objects in this way.

  • PHP now supports abstract classes and interfaces.

Many of these improvements are due to some fundamental changes under the hood.

    [ Team LiB ] Previous Section Next Section