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;
}



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



Extending and Embedding PHP
Extending and Embedding PHP
ISBN: 067232704X
EAN: 2147483647
Year: 2007
Pages: 175
Authors: Sara Golemon

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net