Re: call user defined function with args

From: Date: Sat, 28 Apr 2012 22:15:57 +0000
Subject: Re: call user defined function with args
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-60356@lists.php.net to get a copy of this message
On Sat, Apr 28, 2012 at 11:49 PM, Yader Hernandez <yader.hernandez@gmail.com> wrote: > I had a look at > > http://lxr.php.net/opengrok/xref/PHP_5_4/ext/standard/basic_functions.c#4714 > and > I don't understand how it's passing the arguments into the closure given by > the user. > > I can successfully call the closure given, but passing arguments into the > closure is something I'm not clear on. > > Can someone please shed some light? Look at the zend_parse_parameters call. It fetches the params into fci.params and their number into fci.param_count. zend_fcall_info.params is defined as zval***, so it's basically an array of zval**. So you simply have to create one with your arguments :) Hope that helps, Nikita

« previous php.internals (#60356) next »