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 (\Error $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 7: Undefined constant "UNDEF_CONST"
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 7: Undefined constant "UNDEF_CONST"

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:
47.72 ms | 401 KiB | 8 Q