3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace Foo; class StreamHandler { public $errorMessage; public function __construct() { $this->errorMessage = null; set_error_handler([$this, 'customErrorHandler']); $stream = fopen('c:/fososdfsdfsd', 'a'); restore_error_handler(); } private function customErrorHandler(int $code, string $msg): bool { $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); return true; } } function fopen() { throw new \Exception(); } try{ $f = new StreamHandler; var_dump($f->errorMessage); }catch (\Throwable){ } $a = []; var_dump($a[1]);
Output for git.master_jit, git.master, rfc.property-hooks
Fatal error: Uncaught Error: Invalid callback Foo\StreamHandler::customErrorHandler, cannot access private method Foo\StreamHandler::customErrorHandler() in /in/e3L7U:37 Stack trace: #0 {main} thrown in /in/e3L7U on line 37
Process exited with code 255.

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:
55.76 ms | 1162 KiB | 4 Q