WHEN ATTEMPTING TO SOLVE A NEW PROBLEM, IT'S BEST to ask: "Is this really new?" Chances are, someone out there has done something similar, and released her code for public consumption. Therefore, it's worth engaging the use of your favorite search engine to find out if there's an existing implementation you can borrow from, and adapt to your needs. After all, why reinvent the wheel when someone else has already figured out they should be round?
The PHP Life Cycle
Variables from the Inside Out
Memory Management
Setting Up a Build Environment
Your First Extension
Returning Values
Accepting Parameters
Working with Arrays and HashTables
The Resource Data Type
PHP4 Objects
PHP5 Objects
Startup, Shutdown, and a Few Points in Between
INI Settings
Accessing Streams
Implementing Streams
Diverting the Stream
Configuration and Linking
Extension Generators
Setting Up a Host Environment
Advanced Embedding
Appendix A. A Zend API Reference
Appendix B. PHPAPI
Appendix C. Extending and Embedding Cookbook
Appendix D. Additional Resources