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.

Категории