3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function recurseBenchCallerContex($iterations, $recursionLimit) { if($recursionLimit > 0) { $this->recurseBenchCallerContex($iterations, $recursionLimit - 1); } $start = microtime(true); for($c = 0; $c < $iterations; $c++) { $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); $class = isset($trace[1]['class']) ? $trace[1]['class'] : null; } var_dump('debug_backtrace', microtime(true) - $start); $start = microtime(true); for($c = 0; $c < $iterations; $c++) { $class = get_called_class(); } $start = microtime(true); var_dump('get_called_class', microtime(true) - $start); } } $foo = new Foo; $foo->recurseBenchCallerContex(10000, 0);
Output for 7.2.0
string(15) "debug_backtrace" float(0.002741813659668) string(16) "get_called_class" float(0)
Output for 7.1.7
string(15) "debug_backtrace" float(0.002392053604126) string(16) "get_called_class" float(0)
Output for 7.1.6
string(15) "debug_backtrace" float(0.0033290386199951) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.1.5
string(15) "debug_backtrace" float(0.004021167755127) string(16) "get_called_class" float(0)
Output for 7.1.0
string(15) "debug_backtrace" float(0.0027949810028076) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 7.0.20
string(15) "debug_backtrace" float(0.0056920051574707) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.0.14
string(15) "debug_backtrace" float(0.0052490234375) string(16) "get_called_class" float(0)
Output for 7.0.6
string(15) "debug_backtrace" float(0.004417896270752) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.0.5
string(15) "debug_backtrace" float(0.0034961700439453) string(16) "get_called_class" float(0)
Output for 7.0.4
string(15) "debug_backtrace" float(0.0036580562591553) string(16) "get_called_class" float(0)
Output for 7.0.3
string(15) "debug_backtrace" float(0.0034749507904053) string(16) "get_called_class" float(0)
Output for 7.0.2
string(15) "debug_backtrace" float(0.0037188529968262) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.0.1
string(15) "debug_backtrace" float(0.0030388832092285) string(16) "get_called_class" float(0)
Output for 7.0.0
string(15) "debug_backtrace" float(0.0036280155181885) string(16) "get_called_class" float(0)
Output for 5.6.28
string(15) "debug_backtrace" float(0.01099705696106) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.6.21
string(15) "debug_backtrace" float(0.0071849822998047) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.6.20
string(15) "debug_backtrace" float(0.0088140964508057) string(16) "get_called_class" float(0)
Output for 5.6.19
string(15) "debug_backtrace" float(0.0084309577941895) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.6.18
string(15) "debug_backtrace" float(0.0067300796508789) string(16) "get_called_class" float(0)
Output for 5.6.17
string(15) "debug_backtrace" float(0.0073740482330322) string(16) "get_called_class" float(0)
Output for 5.6.16
string(15) "debug_backtrace" float(0.0062160491943359) string(16) "get_called_class" float(0)
Output for 5.6.15
string(15) "debug_backtrace" float(0.0073168277740479) string(16) "get_called_class" float(0)
Output for 5.6.14
string(15) "debug_backtrace" float(0.007112979888916) string(16) "get_called_class" float(0)
Output for 5.6.13
string(15) "debug_backtrace" float(0.0064268112182617) string(16) "get_called_class" float(0)
Output for 5.6.12
string(15) "debug_backtrace" float(0.0081338882446289) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 5.6.11
string(15) "debug_backtrace" float(0.0086519718170166) string(16) "get_called_class" float(0)
Output for 5.6.10
string(15) "debug_backtrace" float(0.0074009895324707) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.6.9
string(15) "debug_backtrace" float(0.0074889659881592) string(16) "get_called_class" float(0)
Output for 5.6.8
string(15) "debug_backtrace" float(0.0065832138061523) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 5.5.35
string(15) "debug_backtrace" float(0.0047659873962402) string(16) "get_called_class" float(0)
Output for 5.5.34
string(15) "debug_backtrace" float(0.0078427791595459) string(16) "get_called_class" float(0)
Output for 5.5.33
string(15) "debug_backtrace" float(0.0073699951171875) string(16) "get_called_class" float(0)
Output for 5.5.32
string(15) "debug_backtrace" float(0.0056390762329102) string(16) "get_called_class" float(0)
Output for 5.5.31
string(15) "debug_backtrace" float(0.0064091682434082) string(16) "get_called_class" float(0)
Output for 5.5.30
string(15) "debug_backtrace" float(0.0089349746704102) string(16) "get_called_class" float(0)
Output for 5.5.29
string(15) "debug_backtrace" float(0.0067400932312012) string(16) "get_called_class" float(0)
Output for 5.5.28
string(15) "debug_backtrace" float(0.0061080455780029) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 5.5.27
string(15) "debug_backtrace" float(0.0059630870819092) string(16) "get_called_class" float(0)
Output for 5.5.26
string(15) "debug_backtrace" float(0.0055959224700928) string(16) "get_called_class" float(0)
Output for 5.5.25
string(15) "debug_backtrace" float(0.0077250003814697) string(16) "get_called_class" float(0)
Output for 5.5.24
string(15) "debug_backtrace" float(0.0070829391479492) string(16) "get_called_class" float(0)
Output for 5.4.45
string(15) "debug_backtrace" float(0.0081970691680908) string(16) "get_called_class" float(0)
Output for 5.4.44
string(15) "debug_backtrace" float(0.0077729225158691) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.43
string(15) "debug_backtrace" float(0.0055499076843262) string(16) "get_called_class" float(0)
Output for 5.4.42
string(15) "debug_backtrace" float(0.0080060958862305) string(16) "get_called_class" float(0)
Output for 5.4.41
string(15) "debug_backtrace" float(0.007627010345459) string(16) "get_called_class" float(0)
Output for 5.4.40
string(15) "debug_backtrace" float(0.0084738731384277) string(16) "get_called_class" float(0)
Output for 5.4.39
string(15) "debug_backtrace" float(0.0068249702453613) string(16) "get_called_class" float(0)
Output for 5.4.38
string(15) "debug_backtrace" float(0.0062930583953857) string(16) "get_called_class" float(0)
Output for 5.4.37
string(15) "debug_backtrace" float(0.0054500102996826) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.36
string(15) "debug_backtrace" float(0.0055968761444092) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.35
string(15) "debug_backtrace" float(0.0053889751434326) string(16) "get_called_class" float(0)
Output for 5.4.34
string(15) "debug_backtrace" float(0.0080678462982178) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.32
string(15) "debug_backtrace" float(0.0063869953155518) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 5.4.31
string(15) "debug_backtrace" float(0.0079269409179688) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.30
string(15) "debug_backtrace" float(0.0068569183349609) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.29
string(15) "debug_backtrace" float(0.0067539215087891) string(16) "get_called_class" float(0)
Output for 5.4.28
string(15) "debug_backtrace" float(0.0072469711303711) string(16) "get_called_class" float(0)
Output for 5.4.27
string(15) "debug_backtrace" float(0.0069451332092285) string(16) "get_called_class" float(0)
Output for 5.4.26
string(15) "debug_backtrace" float(0.0067958831787109) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.25
string(15) "debug_backtrace" float(0.0070841312408447) string(16) "get_called_class" float(0)
Output for 5.4.24
string(15) "debug_backtrace" float(0.0068740844726562) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.23
string(15) "debug_backtrace" float(0.0069570541381836) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.22
string(15) "debug_backtrace" float(0.0069019794464111) string(16) "get_called_class" float(0)
Output for 5.4.21
string(15) "debug_backtrace" float(0.0068252086639404) string(16) "get_called_class" float(1.9073486328125E-6)
Output for 5.4.20
string(15) "debug_backtrace" float(0.0065889358520508) string(16) "get_called_class" float(0)
Output for 5.4.19
string(15) "debug_backtrace" float(0.0074918270111084) string(16) "get_called_class" float(0)
Output for 5.4.18
string(15) "debug_backtrace" float(0.0070469379425049) string(16) "get_called_class" float(0)
Output for 5.4.17
string(15) "debug_backtrace" float(0.0075209140777588) string(16) "get_called_class" float(0)
Output for 5.4.16
string(15) "debug_backtrace" float(0.0072751045227051) string(16) "get_called_class" float(0)
Output for 5.4.15
string(15) "debug_backtrace" float(0.0066988468170166) string(16) "get_called_class" float(0)
Output for 5.4.14
string(15) "debug_backtrace" float(0.01019811630249) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 5.4.13
string(15) "debug_backtrace" float(0.0074141025543213) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.12
string(15) "debug_backtrace" float(0.007483959197998) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.11
string(15) "debug_backtrace" float(0.0070409774780273) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.10
string(15) "debug_backtrace" float(0.0072729587554932) string(16) "get_called_class" float(0)
Output for 5.4.9
string(15) "debug_backtrace" float(0.0076229572296143) string(16) "get_called_class" float(0)
Output for 5.4.8
string(15) "debug_backtrace" float(0.0096790790557861) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 5.4.7
string(15) "debug_backtrace" float(0.0072059631347656) string(16) "get_called_class" float(0)
Output for 5.4.6
string(15) "debug_backtrace" float(0.0076539516448975) string(16) "get_called_class" float(0)
Output for 5.4.5
string(15) "debug_backtrace" float(0.0075850486755371) string(16) "get_called_class" float(0)
Output for 5.4.4
string(15) "debug_backtrace" float(0.0074501037597656) string(16) "get_called_class" float(0)
Output for 5.4.3
string(15) "debug_backtrace" float(0.0094180107116699) string(16) "get_called_class" float(0)
Output for 5.4.2
string(15) "debug_backtrace" float(0.0075950622558594) string(16) "get_called_class" float(0)
Output for 5.4.1
string(15) "debug_backtrace" float(0.0072300434112549) string(16) "get_called_class" float(1.9073486328125E-6)
Output for 5.4.0
string(15) "debug_backtrace" float(0.0076689720153809) string(16) "get_called_class" float(0)

preferences:
113.71 ms | 401 KiB | 91 Q