3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ThrowsError { public $name = 'unnamed'; public function __construct($name) { $this->name = $name; throw new \Exception("I blew up the constructor of '$name'\n"); } } $emptyVar = null; $obj = (object)array('number' => 1); try { $emptyVar = new ThrowsError('emptyVar'); } catch (\Exception $e) { print($e->getMessage()); } try { $obj = new ThrowsError('obj'); } catch (\Exception $e) { print($e->getMessage()); } try { $notPreviouslyDefined = new ThrowsError('notPreviouslyDefined'); } catch (\Exception $e) { print($e->getMessage()); } var_dump($emptyVar); var_dump($obj); var_dump($notPreviouslyDefined);
Output for git.master, git.master_jit, rfc.property-hooks
I blew up the constructor of 'emptyVar' I blew up the constructor of 'obj' I blew up the constructor of 'notPreviouslyDefined' NULL object(stdClass)#1 (1) { ["number"]=> int(1) } Warning: Undefined variable $notPreviouslyDefined in /in/EfkNG on line 32 NULL

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