3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if (!defined('PHP_VERSION_ID')) { $version = explode('.', PHP_VERSION); define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); } function a($depth = 0) { //return last backtrace call. If backtrace bigger then 3, return third call. if($depth === 1000) { if(PHP_VERSION_ID >= 50400) { return array_slice(array_slice(debug_backtrace(~ DEBUG_BACKTRACE_PROVIDE_OBJECT & ~ DEBUG_BACKTRACE_IGNORE_ARGS, 3), 0, 3), -1, 1); } elseif(PHP_VERSION_ID >= 50306) { return array_slice(array_slice(debug_backtrace(~ DEBUG_BACKTRACE_PROVIDE_OBJECT), 0, 3), -1, 1); } elseif(PHP_VERSION_ID >= 50205) { return array_slice(array_slice(debug_backtrace(FALSE), 0, 3), -1, 1); } else return array_slice(array_slice(debug_backtrace(), 0, 3), -1, 1); } return a(++$depth, str_repeat("a", 1000)); } var_dump(a());
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/9uKDe" ["line"]=> int(29) ["function"]=> string(1) "a" ["args"]=> array(2) { [0]=> int(999) [1]=> string(1000) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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