structure when dealing with classes. The first is to declare a
'zend_objects_destroy_object' handler:
...
retval.handle = zend_objects_store_put(intern,
(zend_objects_store_dtor_t) zend_objects_destroy_object,
my_free_function_callback, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
...
In which 'my_free_function_callback' is the callback that frees
underlying structure information. The alternative is to use __destruct:
PHP_METHOD(my_class, __destruct)
{
}
...
static const zend_function_entry my_class_methods[] = {
...
PHP_ME(my_class, __destruct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR)
...
};
Which is considered best-practice? I'm leaning toward the latter, but
want to make sure there aren't any issues with relying on the __destruct
approach.
--
Thomas Hruska
CubicleSoft President
I've got great, time saving software that you will find useful.
http://cubiclesoft.com/