2

Suppose this scenario:

class B extend class A and there is a method "myMethod" defined in class A.

Inside myMethod I need to know the method name

Using

__METHOD__ always return the "className::" part referred to A A::myMethod

My solution is:

static::class."::".__FUNCTION__

In this way return the class reference to current working class

B::methodName

This work like a charm. But what if I need it in debug_backtrace()?

In debug_backtrace the [class] always refers to class A (accordingly with example provided)

How to obtain a correct binding in debug_backtrace?

Vega
  • 27,856
  • 27
  • 95
  • 103
sdotbertoli
  • 131
  • 1
  • 4

0 Answers0