Faking Late Static Binding before php 5.3

前端 未结 6 1652
天命终不由人
天命终不由人 2021-01-04 13:04

I need an inherited static function \"call\" to call another static function \"inner\" that has been overridden. I could do this with late static binding, but my host does

6条回答
  •  心在旅途
    2021-01-04 13:39

    If performance is not an issue, you can use debug_backtrace() to find the called class:

    $bt = debug_backtrace();
    return get_class($bt[1]['object']); 
    

    http://php.net/manual/en/function.debug-backtrace.php

提交回复
热议问题