php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44539 Anonymous Functions
Submitted: 2008-03-26 16:36 UTC Modified: 2008-03-26 17:38 UTC
From: xwisdom at yahoo dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.5 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xwisdom at yahoo dot com
New email:
PHP Version: OS:

 

 [2008-03-26 16:36 UTC] xwisdom at yahoo dot com
Description:
------------
Hello,

I would like to see improved anonymous functions in PHP6 or maybe 5.2.6

It would be really nice to be able to do the following similar to what we can do in Javascript:

$fn = function($a,$b){
   return $a + $b;
}

echo $fn(2,5);

// with anonymous functions we can do things like:
$object.each(function($index,$value) {
   // do something here
});

// to remove reference to the function we just do this:
unset($fn); // or $fn = null;

Anonymous functions must conform to scope and maybe closures, etc.

__
xwisdom
http://xwisdomhtml.com



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-26 17:38 UTC] colder@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

http://wiki.php.net/gsoc/2008#anonymous_functions_and_closures_and_other_missing_object_oriented_features
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC