2012-07-23 3 views

답변

2

이 말하기를 :

반환 당신이 PHP 5.4이있는 경우

그래서 폐쇄에 바인딩이 포인터 :

<?php 
class MyObj {} 
$foo = function() { }; 
$obj = new MyObj; 
$foo = $foo->bindTo($obj); // Inside the newly returned closure, $this == $obj 
$reflector = new ReflectionFunction($foo); 
assert($obj === $reflector->getClosureThis()); 

즉, 그것은 폐쇄의 $this 포인터를 반환합니다.

+0

우수 감사합니다. – Benjamin

관련 문제