Chapter 22. Extending PHP: Part II

Now that you’ve mastered the basics of extension authoring, this chapter covers advanced extension features. In this chapter you will see how to write classes and objects in extensions, how to write custom session handlers, and how to use the streams API.

Implementing Classes

By far the largest change from PHP 4 to PHP 5 is the new object model. Mirroring this, the biggest change from PHP 4 extensions to PHP 5 extensions is handling classes and objects. The procedural extension code you learned in Chapter 21, “Extending PHP: Part I,” is almost entirely backward-portable to PHP 4. The use of macros for many of the functions helps things: Macros allow for internal reimplementation without invalidating extension ...

Get Advanced PHP Programming 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.