Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60357 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46208 invoked from network); 28 Apr 2012 22:41:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2012 22:41:33 -0000 Authentication-Results: pb1.pair.com header.from=yader.hernandez@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yader.hernandez@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: yader.hernandez@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:43230] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/D7-06766-C127C9F4 for ; Sat, 28 Apr 2012 18:41:32 -0400 Received: by obbuo13 with SMTP id uo13so2742238obb.29 for ; Sat, 28 Apr 2012 15:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=p5yPZJmF4795F10dN3b4wU9DZk6j2wWNCBSTlIQqCG8=; b=Ex0EP/8790S7TGaV2zvTokdyg09MBkwxErQP4TQlQFca4jAypsUTGDKu8DUvtGDoLv tAzSD1432w1RPBtCO/pD85brnvQtBJUIQ1szeL0u3yzzsFm/MFzkzyDMIWwuwu/1OUAe yFyVrP8AZUWwX0+Ho/FymyrnEYIB9ksDqKc8LWcKXRHRaPEB3E0dzKIOEjCOWDLjPP3O 6sf4BYofn0ohpplDfgvSXnSAltFknc87VrhKZVmNolN7auaIcw/m7EanOIknaiU9iRrh WVk427+2P7bUjJeslIiopKVMndeoFyfSN2kj/IqR7MXrqcJHso0aMWs53Cgw748W16cQ Zewg== MIME-Version: 1.0 Received: by 10.60.19.106 with SMTP id d10mr19196762oee.40.1335652889805; Sat, 28 Apr 2012 15:41:29 -0700 (PDT) Received: by 10.60.147.199 with HTTP; Sat, 28 Apr 2012 15:41:29 -0700 (PDT) In-Reply-To: References: Date: Sat, 28 Apr 2012 15:41:29 -0700 Message-ID: To: Nikita Popov Cc: jpauli , Laruence , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=e89a8ff1c4a80a42a704bec4ec39 Subject: Re: [PHP-DEV] call user defined function with args From: yader.hernandez@gmail.com (Yader Hernandez) --e89a8ff1c4a80a42a704bec4ec39 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Apr 28, 2012 at 3:15 PM, Nikita Popov wrote: > On Sat, Apr 28, 2012 at 11:49 PM, Yader Hernandez > 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 > Ah! Great it works now. Thanks! I'm assuming that return_value in this case is being used as whatever the closure returned ? ie. function ($element) { return false; } then that means I can do Z_LVAL_P(return_value) /* 0 */, correct ? --e89a8ff1c4a80a42a704bec4ec39--