zend variables object


ObjectsPodręcznik PHPPoprzedniRozdział 33. Creating VariablesNastępnyObjects Since objects can be converted to arrays (and vice versa), you might have already guessed that they have a lot of similarities to arrays in PHP. Objects are maintained with the same hash functions, but there's a different API for creating them. To initialize an object, you use the function object_init(): zval *new_object; MAKE_STD_ZVAL(new_object); if(object_init(new_object) != SUCCESS) { // do error handling here } You can use the functions described in Tabela 33-4 to add members to your object. Tabela 33-4. Zend's API for Object CreationFunctionDescriptionadd_property_long(zval *object, char *key, long l);()Adds a long to the object.add_property_unset(zval *object, char *key);()Adds an unset property to the object.add_property_bool(zval *object, char *key, int b);()Adds a Boolean to the object.add_property_resource(zval *object, char *key, long r);()Adds a resource to the object.add_property_double(zval *object, char *key, double d);()Adds a double to the object.add_property_string(zval *object, char *key, char *str, int duplicate);()Adds a string to the object.add_property_stringl(zval *object, char *key, char *str, uint length, int duplicate);()Adds a string of the specified length to the object. This function is faster than add_property_string() and also binary-safe. add_property_zval(zval *obect, char *key, zval *container):() Adds a zval container to the object. This is useful if you have to add properties which aren't simple types like integers or strings but arrays or other objects. PoprzedniSpis treściNastępnyArraysPoczątek rozdziałuResources

Wyszukiwarka

Podobne podstrony:
zend variables string
zend variables boolean
zend variables
zend variables global
zend variables float
zend variables resource
zend variables constant
zend variables long
zend variables array
zend variables array
zend arguments variable
stream writer objects
ObjectImpl
function hwapi object remove

więcej podobnych podstron