Req #46988 [Fbk]: 2 requests: Closures Recursion & __callFunction

From: Date: Wed, 07 Jan 2015 21:49:48 +0000
Subject: Req #46988 [Fbk]: 2 requests: Closures Recursion & __callFunction
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189717@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=46988&edit=1 ID: 46988 Updated by: requinix@php.net Reported by: info at netmosfera dot it Summary: 2 requests: Closures Recursion & __callFunction Status: Feedback Type: Feature/Change Request Package: *General Issues PHP Version: 5.3.0 Block user comment: N Private report: N New Comment: First request sounds like a plain function version of a class's __call. notDefined(); // -> __callFunction("notDefined", array()) Second request doesn't have the right syntax but the idea of getting a closure to call itself is already possible: $increment = function($i) use (&$increment) { // reference echo ++$i; if ($i == 20) return; $increment($i); }; $increment(0); Previous Comments: ------------------------------------------------------------------------ [2015-01-07 20:47:59] levim@php.net It is unclear what you are asking for, could you please clarify? ------------------------------------------------------------------------ [2009-01-02 01:05:57] info at netmosfera dot it Description: ------------ hello, i have two requests for next releases of php like __call & __callStatic, __callFunction... for dynamic function overloading and recursion for closures Reproduce code: --------------- function __callFunction($funcname, Array $arguments) { echo $funcname; } notDefined(); --------------- function($increment) use ($i = 0) { // code here // code here echo ++$increment; if ($increment==20) return; function use($increment); }; alternative syntax: recursion use($increment); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=46988&edit=1

« previous php.bugs (#189717) next »