You will not have many options there. The other option (which was posted in the other question) to force the caller to provde it's information with the function call (using PHP magic constants):
callFunction(1, 2, 3, __FUNCTION__)
callFunction(1, 2, 3, __CLASS__, __METHOD__)
callFunction(1, 2, 3, $this, __METHOD__)
or
$class = new ReflectionClass( __CLASS__ );
$method = $class->getMethod( __METHOD__ );
callFunction(1, 2, 3, $method) // $method would be a ReflectionMethod obj
would be a possible alternative. But it's
- obfuscating your code
- can be "manipulated" which might cause the code of
callFunction
to fail and it would be quite difficult to track those errors down.
If I were in your place, I would try to avoid it in a function that is used throughout your code. use debug_backtrace
(even if it might be 'slow'). Readable code wins over fast code.