Chapter 21. Extending PHP: Part I

Under the hood, PHP internal functions and classes are all implemented in C. Developers can write PHP functions and classes in C or C++ as well. There are two major reasons you might want to write your own PHP extensions:

  • Interfacing with an external library—If you have an external library you would like to have access to in PHP, the only real solution is to write an extension wrapper for it. You might want to do this for a library that you have developed in-house, a library whose license precludes a wrapper library for it being included in the PHP distribution, or a library that simply hasn’t had a PHP interface released. In the latter case, the library may be an ideal candidate for inclusion in PHP via the ...

Get Advanced PHP Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.