2

If a zval is a callable object, how can I run it in my extension c code ?

or how to convert a zval to a zend_fcall_info

4

1 回答 1

1

after search for the zend_is_callable and dive into the php src code, I know how to call a callable zval:

zval ret;

zval* params[] = { param }; // param is zval* too

if (SUCCESS == call_user_function(CG(function_table), NULL, callable, &retval, 1, params TSRMLS_CC)) {
    // callable is a zval*
    // you can do something with the retval now
}
于 2012-09-23T16:55:38.720 回答