3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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);
based on 1XU15
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)