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"; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'file' => '/in/iQoni', 'line' => 17, 'function' => 'meth', 'class' => 'cls', 'type' => '::', 'args' => array ( 0 => 1, 1 => 'hello', ), ), ) array ( 0 => array ( 'file' => '/in/iQoni', 'line' => 24, 'function' => 'meth2', 'class' => 'cls', 'type' => '->', 'args' => array ( 0 => 1, 1 => 'hello', ), ), ) array ( 0 => array ( 'file' => '/in/iQoni', 'line' => 35, 'function' => 'func', 'args' => array ( ), ), ) array ( 0 => array ( 'file' => '/in/iQoni', 'line' => 42, 'function' => '{closure}', 'args' => array ( ), ), ) array ( )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
66.66 ms | 407 KiB | 5 Q