3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function recurseBenchCallerContex($iterations, $recursionLimit) { if($recursionLimit > 0) { return $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(1000, 100);
Output for 7.4.0
string(15) "debug_backtrace" float(0.0005040168762207) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 7.1.29, 7.3.12
string(15) "debug_backtrace" float(0.0005040168762207) string(16) "get_called_class" float(0)
Output for 7.3.11
string(15) "debug_backtrace" float(0.00051593780517578) string(16) "get_called_class" float(0)
Output for 7.3.10
string(15) "debug_backtrace" float(0.00034093856811523) string(16) "get_called_class" float(0)
Output for 7.3.9
string(15) "debug_backtrace" float(0.00034308433532715) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 7.3.8
string(15) "debug_backtrace" float(0.00046992301940918) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.3.7
string(15) "debug_backtrace" float(0.00050210952758789) string(16) "get_called_class" float(0)
Output for 7.3.6
string(15) "debug_backtrace" float(0.00074100494384766) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.3.5
string(15) "debug_backtrace" float(0.00060105323791504) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.3.4
string(15) "debug_backtrace" float(0.00042891502380371) string(16) "get_called_class" float(0)
Output for 7.3.3
string(15) "debug_backtrace" float(0.00034284591674805) string(16) "get_called_class" float(0)
Output for 7.3.2
string(15) "debug_backtrace" float(0.00058913230895996) string(16) "get_called_class" float(0)
Output for 7.3.1
string(15) "debug_backtrace" float(0.00034022331237793) string(16) "get_called_class" float(0)
Output for 7.3.0
string(15) "debug_backtrace" float(0.00065803527832031) string(16) "get_called_class" float(0)
Output for 7.2.25
string(15) "debug_backtrace" float(0.00060486793518066) string(16) "get_called_class" float(0)
Output for 7.2.24
string(15) "debug_backtrace" float(0.00058388710021973) string(16) "get_called_class" float(0)
Output for 7.2.23
string(15) "debug_backtrace" float(0.00039410591125488) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.2.22
string(15) "debug_backtrace" float(0.00042009353637695) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.2.21
string(15) "debug_backtrace" float(0.00073599815368652) string(16) "get_called_class" float(0)
Output for 7.2.20
string(15) "debug_backtrace" float(0.0003809928894043) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.2.19
string(15) "debug_backtrace" float(0.0003819465637207) string(16) "get_called_class" float(0)
Output for 7.2.18
string(15) "debug_backtrace" float(0.0003969669342041) string(16) "get_called_class" float(0)
Output for 7.2.17
string(15) "debug_backtrace" float(0.00037884712219238) string(16) "get_called_class" float(0)
Output for 7.2.16
string(15) "debug_backtrace" float(0.00037789344787598) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.2.15
string(15) "debug_backtrace" float(0.00052404403686523) string(16) "get_called_class" float(0)
Output for 7.2.14
string(15) "debug_backtrace" float(0.00038003921508789) string(16) "get_called_class" float(0)
Output for 7.2.13
string(15) "debug_backtrace" float(0.00037789344787598) string(16) "get_called_class" float(0)
Output for 7.2.12
string(15) "debug_backtrace" float(0.00040388107299805) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.2.11
string(15) "debug_backtrace" float(0.00040102005004883) string(16) "get_called_class" float(0)
Output for 7.2.10
string(15) "debug_backtrace" float(0.00040411949157715) string(16) "get_called_class" float(0)
Output for 7.2.9
string(15) "debug_backtrace" float(0.00042390823364258) string(16) "get_called_class" float(0)
Output for 7.2.8
string(15) "debug_backtrace" float(0.00037717819213867) string(16) "get_called_class" float(0)
Output for 7.2.7
string(15) "debug_backtrace" float(0.00066304206848145) string(16) "get_called_class" float(0)
Output for 7.2.6
string(15) "debug_backtrace" float(0.00038290023803711) string(16) "get_called_class" float(0)
Output for 7.2.5
string(15) "debug_backtrace" float(0.00037908554077148) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 7.2.4
string(15) "debug_backtrace" float(0.00058794021606445) string(16) "get_called_class" float(0)
Output for 7.2.3
string(15) "debug_backtrace" float(0.00054001808166504) string(16) "get_called_class" float(0)
Output for 7.2.2
string(15) "debug_backtrace" float(0.00041890144348145) string(16) "get_called_class" float(0)
Output for 7.2.1
string(15) "debug_backtrace" float(0.00062298774719238) string(16) "get_called_class" float(0)
Output for 7.2.0
string(15) "debug_backtrace" float(0.00063300132751465) string(16) "get_called_class" float(0)
Output for 7.1.33
string(15) "debug_backtrace" float(0.00049901008605957) string(16) "get_called_class" float(0)
Output for 7.1.32
string(15) "debug_backtrace" float(0.00078105926513672) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.1.31
string(15) "debug_backtrace" float(0.00049209594726562) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 7.1.30
string(15) "debug_backtrace" float(0.00088214874267578) string(16) "get_called_class" float(0)
Output for 7.1.28
string(15) "debug_backtrace" float(0.00057291984558105) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.1.27
string(15) "debug_backtrace" float(0.00051093101501465) string(16) "get_called_class" float(0)
Output for 7.1.26
string(15) "debug_backtrace" float(0.0012760162353516) string(16) "get_called_class" float(0)
Output for 7.1.25
string(15) "debug_backtrace" float(0.00079894065856934) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.1.7
string(15) "debug_backtrace" float(0.00059700012207031) string(16) "get_called_class" float(0)
Output for 7.1.6
string(15) "debug_backtrace" float(0.00064611434936523) string(16) "get_called_class" float(0)
Output for 7.1.5
string(15) "debug_backtrace" float(0.00064802169799805) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 7.0.20
string(15) "debug_backtrace" float(0.00053977966308594) string(16) "get_called_class" float(0)
Output for 5.4.45
string(15) "debug_backtrace" float(0.0013620853424072) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.44
string(15) "debug_backtrace" float(0.0014290809631348) string(16) "get_called_class" float(0)
Output for 5.4.43
string(15) "debug_backtrace" float(0.00093388557434082) string(16) "get_called_class" float(0)
Output for 5.4.42
string(15) "debug_backtrace" float(0.0011091232299805) string(16) "get_called_class" float(0)
Output for 5.4.41
string(15) "debug_backtrace" float(0.0013492107391357) string(16) "get_called_class" float(0)
Output for 5.4.40
string(15) "debug_backtrace" float(0.001594066619873) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.39
string(15) "debug_backtrace" float(0.0014879703521729) string(16) "get_called_class" float(0)
Output for 5.4.38
string(15) "debug_backtrace" float(0.0013918876647949) string(16) "get_called_class" float(0)
Output for 5.4.37
string(15) "debug_backtrace" float(0.001291036605835) string(16) "get_called_class" float(0)
Output for 5.4.36
string(15) "debug_backtrace" float(0.0014851093292236) string(16) "get_called_class" float(0)
Output for 5.4.35
string(15) "debug_backtrace" float(0.0011441707611084) string(16) "get_called_class" float(1.1920928955078E-6)
Output for 5.4.34
string(15) "debug_backtrace" float(0.0012688636779785) string(16) "get_called_class" float(0)
Output for 5.4.32
string(15) "debug_backtrace" float(0.0011000633239746) string(16) "get_called_class" float(0)
Output for 5.4.31
string(15) "debug_backtrace" float(0.0021688938140869) string(16) "get_called_class" float(0)
Output for 5.4.30
string(15) "debug_backtrace" float(0.0014119148254395) string(16) "get_called_class" float(0)
Output for 5.4.29
string(15) "debug_backtrace" float(0.0012969970703125) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.28
string(15) "debug_backtrace" float(0.0014610290527344) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.27
string(15) "debug_backtrace" float(0.001352071762085) string(16) "get_called_class" float(0)
Output for 5.4.26
string(15) "debug_backtrace" float(0.0015189647674561) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.25
string(15) "debug_backtrace" float(0.0014908313751221) string(16) "get_called_class" float(0)
Output for 5.4.24
string(15) "debug_backtrace" float(0.0014281272888184) string(16) "get_called_class" float(0)
Output for 5.4.23
string(15) "debug_backtrace" float(0.0014619827270508) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.22
string(15) "debug_backtrace" float(0.0015151500701904) string(16) "get_called_class" float(0)
Output for 5.4.21
string(15) "debug_backtrace" float(0.0014610290527344) string(16) "get_called_class" float(0)
Output for 5.4.20
string(15) "debug_backtrace" float(0.0015380382537842) string(16) "get_called_class" float(0)
Output for 5.4.19
string(15) "debug_backtrace" float(0.0010979175567627) string(16) "get_called_class" float(0)
Output for 5.4.18
string(15) "debug_backtrace" float(0.001823902130127) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.17
string(15) "debug_backtrace" float(0.00097203254699707) string(16) "get_called_class" float(0)
Output for 5.4.16
string(15) "debug_backtrace" float(0.0014050006866455) string(16) "get_called_class" float(0)
Output for 5.4.15
string(15) "debug_backtrace" float(0.0014379024505615) string(16) "get_called_class" float(0)
Output for 5.4.14
string(15) "debug_backtrace" float(0.0013279914855957) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.13
string(15) "debug_backtrace" float(0.0013089179992676) string(16) "get_called_class" float(0)
Output for 5.4.12
string(15) "debug_backtrace" float(0.0013940334320068) string(16) "get_called_class" float(9.5367431640625E-7)
Output for 5.4.11
string(15) "debug_backtrace" float(0.0013461112976074) string(16) "get_called_class" float(0)
Output for 5.4.10
string(15) "debug_backtrace" float(0.0014371871948242) string(16) "get_called_class" float(0)
Output for 5.4.9
string(15) "debug_backtrace" float(0.0014398097991943) string(16) "get_called_class" float(0)
Output for 5.4.8
string(15) "debug_backtrace" float(0.0014529228210449) string(16) "get_called_class" float(0)
Output for 5.4.7
string(15) "debug_backtrace" float(0.0015811920166016) string(16) "get_called_class" float(0)
Output for 5.4.6
string(15) "debug_backtrace" float(0.0011501312255859) string(16) "get_called_class" float(0)
Output for 5.4.5
string(15) "debug_backtrace" float(0.0011870861053467) string(16) "get_called_class" float(0)
Output for 5.4.4
string(15) "debug_backtrace" float(0.00096702575683594) string(16) "get_called_class" float(0)
Output for 5.4.3
string(15) "debug_backtrace" float(0.0014219284057617) string(16) "get_called_class" float(0)
Output for 5.4.2
string(15) "debug_backtrace" float(0.001384973526001) string(16) "get_called_class" float(0)
Output for 5.4.1
string(15) "debug_backtrace" float(0.0012822151184082) string(16) "get_called_class" float(0)
Output for 5.4.0
string(15) "debug_backtrace" float(0.0016851425170898) string(16) "get_called_class" float(0)

preferences:
85.4 ms | 401 KiB | 103 Q