Objects:
PHP_FUNCTION(date_create)
{
zval *timezone_object = NULL;
char *time_str = NULL;
int time_str_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
RETURN_FALSE;
}
}
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
{
Z_TYPE_P(object) = IS_OBJECT;
object_init_ex(object, pce);
Z_SET_REFCOUNT_P(object, 1);
Z_UNSET_ISREF_P(object);
return object;
}