<?php
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_filter(array_slice(debug_backtrace(false, 3), 0, 3)), -1, 1);
}
return array_slice(array_filter(array_slice(debug_backtrace(false), 0, 3)), -1, 1);
}
return a(++$depth, str_repeat("a", 1000));
}
var_dump(a());
preferences:
41.38 ms | 402 KiB | 5 Q