3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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()));
based on XK54K
Output for 7.0.0 - 7.2.0
int(0) int(-1) string(0) "" array(0) { }
Output for 5.3.18 - 5.6.21
Parse error: syntax error, unexpected '?' in /in/GquSv on line 6
Process exited with code 255.