3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function double(int $value) { return 2 * $value; } function coerceInt(string $value) : int { return (int)$value; } try{ $a = double(coerceInt("5")); var_dump($a); $a = double("5"); var_dump($a); } catch (Throwable $e) { var_dump($e); }
Output for git.master, git.master_jit, rfc.property-hooks
int(10) object(TypeError)#1 (7) { ["message":protected]=> string(96) "double(): Argument #1 ($value) must be of type int, string given, called in /in/Nr2lJ on line 16" ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/Nr2lJ" ["line":protected]=> int(4) ["trace":"Error":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/Nr2lJ" ["line"]=> int(16) ["function"]=> string(6) "double" ["args"]=> array(1) { [0]=> string(1) "5" } } } ["previous":"Error":private]=> NULL }

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