1

Consider this:

$x=new MyClass;
$x->y=function($name){return "Hi, $name";};

to call the closure I use call_user_func($x->y,'Hasan') that it's not so clean and convenient. Is there any better syntax? Perhaps similar to $x->y("Hasan") (which does not work.)

Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173

0 Answers0