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 } |
表格 33-4. Zend's API for Object Creation