3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(1 + 1); // int 2 var_dump('1' + '1'); //int 2 class One { public function __toString() { return '1'; } } var_dump(new One + new One); // Object of class One could not be converted to int int 2 var_dump((string)new One + (string)new One); // int 2 var_dump(2 + 2); // int 4 var_dump('2' + '2'); // int 4 class Two { public function __toString() { return '2'; } } var_dump(new Two + new Two); // Notice: Object of class Two could not be converted to int int 2 var_dump((string)new Two + (string)new Two); // int 4
Output for git.master, git.master_jit, rfc.property-hooks
int(2) int(2) Fatal error: Uncaught TypeError: Unsupported operand types: One + One in /in/OHQqq:12 Stack trace: #0 {main} thrown in /in/OHQqq on line 12
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:
42.32 ms | 401 KiB | 8 Q