Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76641 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29876 invoked from network); 18 Aug 2014 10:08:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Aug 2014 10:08:52 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:34120] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/46-29636-2B0D1F35 for ; Mon, 18 Aug 2014 06:08:51 -0400 Received: by mail.experimentalworks.net (Postfix, from userid 1003) id 2590341B34; Mon, 18 Aug 2014 12:08:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on km31408.keymachine.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.2 X-Spam-HAM-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Received: from [192.168.2.31] (ppp-93-104-0-106.dynamic.mnet-online.de [93.104.0.106]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 5BBAE41B31; Mon, 18 Aug 2014 12:08:54 +0200 (CEST) To: Wei Dai Cc: Aaron Lewis , PHP Internals In-Reply-To: <86EEE03317124B84B62883DBE41C4ADD@gmail.com> References: <86EEE03317124B84B62883DBE41C4ADD@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Mon, 18 Aug 2014 12:07:46 +0200 Message-ID: <1408356466.2617.327.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] =?UTF-8?Q?=E5=9B=9E=E5=A4=8D=EF=BC=9A?= [PHP-DEV] How should I call a PHP function From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) 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