3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { 10 / 0; } catch (\DivisionByZeroError $e) { printf("%d: %s\n", __LINE__, $e->getMessage()); } try { $null->var = false; } catch (\Error $e) { printf("%d: %s\n", __LINE__, $e->getMessage()); } try { $i = 100; $i[] = 'd'; } catch (\Error $e) { printf("%d: %s\n", __LINE__, $e->getMessage()); } try { [''][new stdClass]; } catch (\TypeError $e) { printf("%d: %s\n", __LINE__, $e->getMessage()); } try { $s = 'abc'; $s[''] = 'd'; } catch (\TypeError $e) { printf("%d: %s\n", __LINE__, $e->getMessage()); } try { echo UNDEF_CONST; } catch (\TypeError $e) { printf("%d: %s\n", __LINE__, $e->getMessage()); }
Output for git.master, git.master_jit
2: Division by zero 3: Attempt to assign property "var" on null 4: Cannot use a scalar value as an array 5: Illegal offset type 6: Cannot access offset of type string on string Fatal error: Uncaught Error: Undefined constant "UNDEF_CONST" in /in/li8a2:7 Stack trace: #0 {main} thrown in /in/li8a2 on line 7
Process exited with code 255.
Output for rfc.property-hooks
2: Division by zero 3: Attempt to assign property "var" on null 4: Cannot use a scalar value as an array 5: Cannot access offset of type object on array 6: Cannot access offset of type string on string Fatal error: Uncaught Error: Undefined constant "UNDEF_CONST" in /in/li8a2:7 Stack trace: #0 {main} thrown in /in/li8a2 on line 7
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:
26.78 ms | 401 KiB | 8 Q