3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); set_error_handler(function ($n, $message) { echo 'Error handler called: ' . $message . PHP_EOL; }); set_exception_handler(function ($e) { echo 'Exception handler called: ' . get_class($e) . ' - ' . $e->getMessage() . PHP_EOL; }); function strict(int $i) {} explode(['not', 'valid'], ['arguments']); try { explode(['not', 'valid'], ['arguments']); } catch (Throwable $e) { echo 'Caught exception: ' . get_class($e) . ' - ' . $e->getMessage() . PHP_EOL; } try { eval('eval is evil'); } catch (ParseError $e) { echo 'Caught exception: ' . get_class($e) . ' - ' . $e->getMessage() . PHP_EOL; } try { echo 1 / 0; } catch (DivisionByZeroError $e) { echo 'Caught exception: ' . get_class($e) . ' - ' . $e->getMessage() . PHP_EOL; } try { strict('one'); } catch (TypeError $e) { echo 'Caught exception: ' . get_class($e) . ' - ' . $e->getMessage() . PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
Exception handler called: TypeError - explode(): Argument #1 ($separator) must be of type string, array given

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