Get class name from extended class

后端 未结 3 744
旧时难觅i
旧时难觅i 2021-01-04 04:20

Is it possible to get the name of the top level class from an extended class, without setting it from the top level class. See example below, I would like to get \'Foo\' fro

3条回答
  •  长发绾君心
    2021-01-04 04:37

    get_called_class() for static classes or get_class($this) for instantiated.

    get_called_class(), as Jason said, was introduced in PHP 5.3

提交回复
热议问题