For those that are interested in how PHP works "under the covers" and maybe want to get started writing your own extensions for it, you should check out the PHP Internals Book. It's a collaborative effort between Julien Pauli, Anthony Ferrara and Nikita Popov.
There are three primary goals of this book: Document and describe how PHP internals work, how to extend the language with extensions, how you can interact with the community to develop PHP itself. This book is primarily targeted at developers who have experience in the C programming language. However, where-ever possible we will attempt to distill the information and summarize it so that developers who don’t know C will still be able to understand the content.
The book is a work in progress, but they're off to a good start. They already have sections covering some of the basics of working with classes and objects (including iterators and "magic interfaces").