3v4l.org

run code in 300+ PHP versions simultaneously
<?php function NC($x){ $y = array(); $y['test'] = $x; $returnThis = $y['test'] ?? "Foo"; return $returnThis; } NC(NULL); // I know this will return "Foo". /* But I have no clue about what these will return. */ var_dump(NC(0)); var_dump(NC(-1)); var_dump(NC("")); var_dump(NC(array());
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.29, 5.6.7 - 5.6.13
Parse error: syntax error, unexpected '?' in /in/XK54K on line 6
Process exited with code 255.

preferences:
189.44 ms | 1395 KiB | 65 Q