3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function foo(int $x): void { echo 'This is fine:', $x, PHP_EOL; } // Good foo(12345); // Bad try { foo(3.1415); } catch (TypeError $ex) { echo $ex->getMessage(), PHP_EOL; } // Also bad, apparently! foo(PHP_INT_MAX + (PHP_INT_MAX >> 1));
Output for git.master, git.master_jit, rfc.property-hooks
This is fine:12345 foo(): Argument #1 ($x) must be of type int, float given, called in /in/bmLu5 on line 13 Fatal error: Uncaught TypeError: foo(): Argument #1 ($x) must be of type int, float given, called in /in/bmLu5 on line 19 and defined in /in/bmLu5:4 Stack trace: #0 /in/bmLu5(19): foo(1.3835058055282E+19) #1 {main} thrown in /in/bmLu5 on line 4
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:
49.77 ms | 401 KiB | 8 Q