3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Example { public function foo() { show_backtrace(); } } function show_backtrace() { echo "No options:\n"; print_r(debug_backtrace(0)); echo "\n\nObject:\n"; print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT)); echo "\n\nNo args:\n"; print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); echo "\n\nObject, no args:\n"; print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS)); } $e = new Example(); $e->foo();
Output for 5.3.18 - 5.6.38, hhvm-3.10.1 - 3.21.3, 7.0.0 - 7.3.1
No options: Array ( [0] => Array ( [file] => /in/qj87i [line] => 4 [function] => show_backtrace [args] => Array ( ) ) [1] => Array ( [file] => /in/qj87i [line] => 19 [function] => foo [class] => Example [type] => -> [args] => Array ( ) ) ) Object: Array ( [0] => Array ( [file] => /in/qj87i [line] => 4 [function] => show_backtrace [args] => Array ( ) ) [1] => Array ( [file] => /in/qj87i [line] => 19 [function] => foo [class] => Example [object] => Example Object ( ) [type] => -> [args] => Array ( ) ) ) No args: Array ( [0] => Array ( [file] => /in/qj87i [line] => 4 [function] => show_backtrace ) [1] => Array ( [file] => /in/qj87i [line] => 19 [function] => foo [class] => Example [type] => -> ) ) Object, no args: Array ( [0] => Array ( [file] => /in/qj87i [line] => 4 [function] => show_backtrace ) [1] => Array ( [file] => /in/qj87i [line] => 19 [function] => foo [class] => Example [object] => Example Object ( ) [type] => -> ) )
Output for hhvm-3.22.0
No options: Array ( [0] => Array ( [file] => /in/qj87i [line] => -1 [function] => show_backtrace [args] => Array ( ) ) [1] => Array ( [file] => /in/qj87i [line] => -1 [function] => foo [class] => Example [type] => -> [args] => Array ( ) ) ) Object: Array ( [0] => Array ( [file] => /in/qj87i [line] => -1 [function] => show_backtrace [args] => Array ( ) ) [1] => Array ( [file] => /in/qj87i [line] => -1 [function] => foo [class] => Example [object] => Example Object ( ) [type] => -> [args] => Array ( ) ) ) No args: Array ( [0] => Array ( [file] => /in/qj87i [line] => -1 [function] => show_backtrace ) [1] => Array ( [file] => /in/qj87i [line] => -1 [function] => foo [class] => Example [type] => -> ) ) Object, no args: Array ( [0] => Array ( [file] => /in/qj87i [line] => -1 [function] => show_backtrace ) [1] => Array ( [file] => /in/qj87i [line] => -1 [function] => foo [class] => Example [object] => Example Object ( ) [type] => -> ) )