php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46988 2 requests: Closures Recursion & __callFunction
Submitted: 2009-01-02 01:05 UTC Modified: 2015-01-18 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: info at netmosfera dot it Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.3.0 OS:
Private report: No CVE-ID: None
 [2009-01-02 01:05 UTC] 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);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-07 20:47 UTC] levim@php.net
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues -PHP Version: 5.3.0alpha3 +PHP Version: 5.3.0
 [2015-01-07 20:47 UTC] levim@php.net
It is unclear what you are asking for, could you please clarify?
 [2015-01-07 21:49 UTC] requinix@php.net
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);
 [2015-01-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 23:01:26 2024 UTC