<?php class Test { protected function ts() { return 3; } public function testclosure() { return function() { return $this->ts(); }; } public function testclosure2() { $this2 = $this; return function() use ($this2) { return $this2->ts(); }; } } $t = new Test; $f1 = $t->testclosure(); echo($f1()."\n"); $f2 = $t->testclosure2(); echo($f1()."\n");
You have javascript disabled. You will not be able to edit any code.
There are `>1` results