Re: [PHP-DEV] 回复: [PHP-DEV] How should I call a PHP function

[email protected] (Johannes Schlüter)
Newsgroups php.internals
Message-ID <1408356466.2617.327.camel@guybrush>
On Mon, 2014-08-18 at 10:37 +0800, Wei Dai wrote:
> Hi,
> > Hi,
> > 
> > I'm trying to call a function inside a module, a PHP_FUNCTION.
> > 
> > Other than zend_eval_stringl, what's the direct way to do it?
> Please refer to call_user_function and call_user_function_ex. 

See also the set of zend_call_method_with_[0-4]_params macros in
zend_interfaces.h. Those allow to cache the function pointer (or use the
one provided via "f" option by zend_parse_parameters) and therefore
saving repeated lookups.

But general comment: Do you really want to call a user function? - This
might be the case when using callbacks, typically when this question
pops up the aim is to call some PHP provided function, then often there
is a better C level API ... going via PHP function is cumbersome and
"slow".

johannes
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.