3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler('myErrorHandler'); register_shutdown_function('fatalErrorShutdownHandler'); echo 'Fatal Error Handler ..'; function myErrorHandler($code, $message, $file, $line) { var_dump($message); } function fatalErrorShutdownHandler() { $last_error = error_get_last(); if ($last_error['type'] === E_ERROR) { // fatal error myErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); } } final class Email { const EMAIL = "me@where.com"; private function __destruct() { echo 'Destroying ...',"\n"; return; } } $vo = new Email; echo $vo::EMAIL,"\n"; try { $vo = null; echo 'nullified',"\n"; } catch(Exception $e) { echo $e->getMessage(); } finally { echo "You should not destroy the value object","\n"; } var_dump($vo);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal Error Handler ..me@where.com You should not destroy the value object Fatal error: Uncaught Error: Call to private Email::__destruct() from global scope in /in/gHEAt:34 Stack trace: #0 {main} thrown in /in/gHEAt on line 34 string(117) "Uncaught Error: Call to private Email::__destruct() from global scope in /in/gHEAt:34 Stack trace: #0 {main} thrown"
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:
89.82 ms | 401 KiB | 8 Q