3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { echo "as cuf\n"; call_user_func('omg'); } catch (\Exception $e) { echo $e->getTraceAsString(); } echo "\n\n"; try { omg(); } catch (\Exception $e) { echo "as func call\n"; echo $e->getTraceAsString(); } function omg() { bbq(); } function bbq() { throw new \Exception("testing"); } function getExceptionString(\Exception $ex) { $string = ''; while ($ex) { $string .= "Exception " . get_class($ex) . ': ' . $ex->getMessage()."\n"; foreach ($ex->getTrace() as $tracePart) { $line = false; $string .= var_export($tracePart, true); $string .= "\n"; if (isset($tracePart['file']) ) { $line .= $tracePart['file']." "; } if (isset($tracePart['line']) ) { $line .= $tracePart['line']." "; } if (isset($tracePart["class"])) { $line .= $tracePart["class"]; } if (isset($tracePart["type"])) { $line .= $tracePart["type"]; } if (isset($tracePart["function"])) { $line .= $tracePart["function"]; } if ($line === false) { $string .= "***\n"; } else { $string .= $line."\n"; } } $ex = $ex->getPrevious(); if ($ex) { $string .= "Previous "; } }; return $string; }
Output for git.master, git.master_jit, rfc.property-hooks
as cuf #0 /in/BgGKq(25): bbq() #1 /in/BgGKq(6): omg() #2 {main} as func call #0 /in/BgGKq(25): bbq() #1 /in/BgGKq(15): omg() #2 {main}

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:
38.18 ms | 401 KiB | 8 Q