Req #14404 [Opn->Csd]: scope notation
| From: | jani@php.net | Date: | Wed, 29 Dec 2010 10:56:39 +0000 |
| Subject: | Req #14404 [Opn->Csd]: scope notation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157375@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=14404&edit=1
ID: 14404
Updated by: jani@php.net
Reported by: foobardotcom at poczta dot onet dot pl
Summary: scope notation
-Status: Open
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: all
PHP Version: 4.1.0
-Assigned To:
+Assigned To: jani
Block user comment: N
Private report: N
New Comment:
Use Closures for such. Available since 5.3.0:
http://php.net/manual/en/functions.anonymous.php
Previous Comments:
------------------------------------------------------------------------
[2001-12-10 10:32:00] foobardotcom at poczta dot onet dot pl
What are callbacks? I have created my callback system, and it is working
like that:
class Foo {
function sum($a, $b) {
return $a + $b;
}
}
$staticCB = new Callback("Foo", "sum");
echo $staticCB->execute(array(5, 3)); // should result '8'
$myFoo = new Foo();
$instanceCB = new Callback($myFoo, "sum");
echo $instanceCB->execute(array(2, 4)); // should result '6'
function mySum($a, $b) { return $a + $b;}
$funcCB = new Callback(null, "mySum");
echo $funcCB->execute(array(1, 2)); // should result '3'
I want, you make possible to specify SCOPES, without dummy walkarounds
like strings or variables, so make this possible:
$staticCB = new Callback(Foo::sum);
$instanceCB = new Callback($myFoo->sum);
$funcCB = new Callback(mySum);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=14404&edit=1