3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { class Baz{ function foo(){ print_r(debug_backtrace()); } } function assertTrue(){} class PHPUnitThing{ function testSomething(){ $baz = new Baz(); assertTrue($baz->foo()); // dirty backtrace } } (new PHPUnitThing)->testSomething(); // dirty backtrace $baz = new Baz; assertTrue($baz->foo()); // clean backtrace }
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Array ( [0] => Array ( [file] => /in/BIut2 [line] => 15 [function] => foo [class] => Baz [object] => Baz Object ( ) [type] => -> [args] => Array ( ) ) [1] => Array ( [file] => /in/BIut2 [line] => 19 [function] => testSomething [class] => PHPUnitThing [object] => PHPUnitThing Object ( ) [type] => -> [args] => Array ( ) ) ) Array ( [0] => Array ( [file] => /in/BIut2 [line] => 22 [function] => foo [class] => Baz [object] => Baz Object ( ) [type] => -> [args] => Array ( ) ) )

preferences:
145.66 ms | 406 KiB | 230 Q