Objects

int object_init(zval *arg);
int object_init_ex(zval *arg, zend_class_entry *ce);
int object_and_properties_init(zval *arg, zend_class_entry *ce,
 HashTable *properties TSRMLS_DC);

Instantiates a new object.

Argument

Purpose

arg

Preallocated zval* variable to be initialized as an object.

ce

Class entry of the object to instantiate. object_init() will automatically assign the call entry corresponding to the built-in stdClass.

properties

Initial properties to be copied into the new object in lieu of that class's default properties.

zend_object *zend_objects_get_address(zval *object TSRMLS_DC);
void *zend_object_store_get_object(zval *object TSRMLS_DC);

These functions are identical in all but the typecast in their return value. They retrieve a pointer to the zend_object* struct (or custom structure containing a zend_object in the first element) that corresponds to the passed object zval.

Argument

Purpose

object

Object instance

zend_class_entry *Z_OBJCE_P(zval *object)
zend_class_entry *zend_get_class_entry(zval *object TSRMLS_DC);
int zend_get_object_classname(zval *object,
 char **name, zend_uint *name_len TSRMLS_DC);

Retrieves the class entry or name for a given object.

Argument

Purpose

object

Object instance.

name

On return, populated with a pointer to a NULL-terminated string containing the classname associated with object. The memory location return remains the property of the class entry and should not be freed by the calling scope.

name_len

Returned as the length of the string pointed to by name.

zend_object_handlers *zend_get_std_object_handlers();

Returns a const (unmodifiable) structure containing the standard object handlers used by userspace class definitions and instances of stdClass.


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

Similar book on Amazon

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