3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IOException extends Exception { protected $path; protected $mode; public function __construct($path, $mode, $message) { parent::__construct($message); $this->path = $path; $this->mode = $mode; } public function getPath() { return $this->path; } } class File { protected $path; protected $handle; protected $mode; public function __construct($path) { $this->path = $path; } public function open($mode) { $this->handle = @fopen($this->path, $mode); if (!$this->handle) { throw new IOException( $this->path, $mode, "could not open the file"); } $this->mode = $mode; } } $file = new File("/no/file"); try { $file->open("r"); } catch (IOException $io) { printf( "Exception occured opening %s\n", $io->getPath()); var_dump($io); } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Exception occured opening /no/file object(IOException)#2 (9) { ["message":protected]=> string(23) "could not open the file" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/JDHTi" ["line":protected]=> int(29) ["trace":"Exception":private]=> array(1) { [0]=> array(6) { ["file"]=> string(9) "/in/JDHTi" ["line"]=> int(39) ["function"]=> string(4) "open" ["class"]=> string(4) "File" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> string(1) "r" } } } ["previous":"Exception":private]=> NULL ["path":protected]=> string(8) "/no/file" ["mode":protected]=> string(1) "r" }

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:
52.29 ms | 402 KiB | 8 Q