3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function AddIntAndFloat(int $a, float $b): int { return (string) $a + $b; } try { echo AddIntAndFloat(1.4,'2'); } catch(TypeError $e) { echo $e->getMessage(), PHP_EOL; } try { echo AddIntAndFloat(1,'2'); } catch(TypeError $e) { echo $e->getMessage(), PHP_EOL; } try { echo AddIntAndFloat(1,1); } catch(TypeError $e) { echo $e->getMessage(), PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
AddIntAndFloat(): Argument #1 ($a) must be of type int, float given, called in /in/q1PAq on line 8 AddIntAndFloat(): Argument #2 ($b) must be of type float, string given, called in /in/q1PAq on line 14 AddIntAndFloat(): Return value must be of type int, float returned

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:
28.03 ms | 406 KiB | 5 Q