获取函数一次执行中回调次数

    public function tt($times = 1){

        $rand = mt_rand(1,5);
        echo $rand . '<br/>';

        if ($rand != '5'){
            $times++;
            $this->tt($times);
        } else {
            echo '-----------' . '<br/>';
            echo $times;
            exit;
        }

    }

    public function sss() {
        $this->tt();
        exit;
    }


3
3
1
1
4
5
-----------
6
原文地址:https://www.cnblogs.com/pansidong/p/10951484.html