V. Extending PHP 4.0

Hacking the Core of PHP

Those who know don't talk.

Those who talk don't know.

Sometimes, PHP "as is" simply isn't enough. Although these cases are rare for the average user, professional applications will soon lead PHP to the edge of its capabilities, in terms of either speed or functionality. New functionality cannot always be implemented natively due to language restrictions and inconveniences that arise when having to carry around a huge library of default code appended to every single script, so another method needs to be found for overcoming these eventual lacks in PHP.

As soon as this point is reached, it's time to touch the heart of PHP and take a look at its core, the C code that makes PHP go.

Note: This chapter only deals with the extension of PHP 4.0. Although a lot of the information is relevant to PHP 3.0, none of the examples are designed to be compatible with PHP 3.0. We believe that, if someone makes the effort to extend PHP, PHP 4.0 will be installed anyway. (Recompiling old PHP 3.0 servers doesn't make sense, considering the benefits of the new PHP version).

Also, at the time of this writing, quite a few things in PHP 4.0 were not completely finished and working yet (one of the major things is the thread-safe version of Zend).

Note: Updates of this chapter can be found at http://www.zend.com.

Hacking the Core of PHP