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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to