3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A implements ArrayAccess { function offsetGet($a){ throw new Error; } function offsetExists($a){ echo "noooooooooo"; return false; } function offsetSet($a, $b){} function offsetUnset($a){} } $x = new A; var_dump($x[10] ?? 20); var_dump($f ?? 20);
based on 3SRsk
Output for 7.0.6 - 7.3.0alpha1
nooooooooooint(20) int(20)
Output for 7.0.0 - 7.0.5
Fatal error: Uncaught Error in /in/SbMuT:6 Stack trace: #0 /in/SbMuT(23): A->offsetGet(10) #1 {main} thrown in /in/SbMuT on line 6
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Parse error: syntax error, unexpected '?' in /in/SbMuT on line 23
Process exited with code 255.