3v4l.org

run code in 300+ PHP versions simultaneously
<?php class cls { public static function meth(int $a, string $b) : void { throw new Exception; } public function meth2(int $a, string $b): void { throw new Exception; } } try { cls::meth(1,'hello'); }catch (\Throwable $t) { var_export($t->getTrace()); echo "\n"; } try { (new cls)->meth2(1,'hello'); }catch (\Throwable $t) { var_export($t->getTrace()); echo "\n"; } function func() { throw new Exception; } try { func(); }catch (\Throwable $t) { var_export($t->getTrace()); echo "\n"; } try{ (function() { throw new Exception;})(); } catch (\Throwable $t) { var_export($t->getTrace()); echo "\n"; } try { throw new Exception; } catch (\Throwable $t) { var_export($t->getTrace()); echo "\n"; }

preferences:
62.54 ms | 404 KiB | 5 Q