Edit report at http://bugs.php.net/bug.php?id=14404&edit=1

 ID:                 14404
 Updated by:         [email protected]
 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

Reply via email to