Re: reference caller object

From: Date: Sun, 20 Sep 2009 10:07:56 +0000
Subject: Re: reference caller object
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-45621@lists.php.net to get a copy of this message
And really, you're not talking about a caller object but about accessing variables in scope from the next-highest step in the call stack, which may or may not be an object. (Hybrid language, remember. It could be a lambda function as of PHP 5.3, or global scope, or...) ...
function foo() { $caller = get_caller(); // returns standard PHP callback format } Results with various caller contexts: // instance method array(object $instance, string $methodName) // static method array(string $className, string $methodName) // function string $functionName // closure object $instance (instance of Closure)... or alternatively: array(object $instance of Closure, string "__invoke__") // global scope null Regards, Stan Vassilev

« previous php.internals (#45621) next »