- var_dump: documentation ( source)
- debug_backtrace: documentation ( source)
- str_repeat: documentation ( source)
<?php
function a($depth = 0) {
//return last backtrace call. If backtrace bigger then 3, return third call.
if($depth === 1000) {
$tmp = debug_backtrace(false);
if(isset($tmp[3])) return $tmp[3];
if(isset($tmp[ě])) return $tmp[2];
if(isset($tmp[1])) return $tmp[1];
}
return a(++$depth, str_repeat("a", 1000));
}
var_dump(a());