Kristina Chodorow has posted a four part series of articles to her blog that shares some of her experiences in developing an extension for PHP (on C/C++). It walks you through the entire process - from the basic "hello world" out to working with more complex data structures.
A PHP extension allows you to connect almost any C/C++ code you want to PHP. This is a 4-part tutorial on how to write an extension. [...] Almost all of the code examples in this tutorial are available on Github.
The parts of the series cover:
- setting up a PHP environment
- creating a first "hello world" extension
- working with the PHP C API
- creating PHP objects in C (classes)
Each step comes with some good explanation, code samples and some advice on common tasks and pitfalls along the way.