Zend has posted a new article today from Sara Golemon about something she knows quite well, Writing PHP Extensions.
If you're reading this tutorial, you probably have some interest in writing an extension for the PHP language. If not... well perhaps when we're done you'll have discovered an interest you didn't know existed!
If you've used PHP, you've used extensions. With only a few exceptions, every userspace function in the PHP language is grouped into one extension or another. A great many of these functions are part of the standard extension - over 400 of them in total. The PHP source bundle comes with around 86 extensions, having an average of about 30 functions each. Do the math, that's about 2500 functions. As if this weren't enough, the PECL repository offers over 100 additional extensions, and even more can be found elsewhere on the Internet.
The article continues on, talking more about what extensions can be good for, how they are used in the execution of your applications (lifecycle), how to control their memory allocation, and, of course several examples of how to get started with your own extension.
There's all sorts of little details to get into when working with extensions (INI settings, global values, etc), but she does a great job of keeping them in a light, easy-to-understand format that can help anyone get started quickly and easily with their own PHP extension...




