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

From: Date: Mon, 18 Aug 2014 10:07:46 +0000
Subject: Re: 回复: [PHP-DEV] How should I call a PHP function
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-76641@lists.php.net to get a copy of this message
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

« previous php.internals (#76641) next »