Evolutionary Leaps

There are two key components to a PHP5 object variable. The first is a numeric identifier that, much like the numeric resource IDs found in Chapter 9, "The Resource Data Type," acts as a lookup into a requestwide table of object instances. The elements in this instance table contain a reference to the class entry and the internal properties table as well as other instance-specific information.

The second element within object variables is the handler table, which is able to customize the way the Zend Engine interacts with instances. You'll take a look at handler tables later in the chapter.

zend_class_entry

The class entry is an internal representation of a class definition as you'd declare it in userspace. Just as you saw last chapter, this structure is initialized by a call to INIT_CLASS_ENTRY() with the class's name and its function table then registered by zend_register_internal_class() during the MINIT phase:

zend_class_entry *php_sample3_sc_entry; #define PHP_SAMPLE3_SC_NAME "Sample3_SecondClass" static function_entry php_sample3_sc_functions[] = { { NULL, NULL, NULL } }; PHP_MINIT_FUNCTION(sample3) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, PHP_SAMPLE3_SC_NAME, php_sample3_sc_functions); php_sample3_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); return SUCCESS; }

Категории