3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ifsetor(&$variable, $default = null) { if (isset($variable)) { $tmp = $variable; } else { $tmp = $default; } return $tmp; } $foo = [ 'a' => 'foo' ] $x = ifsetor($foo['a'], 'bar'); echo $x;
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '$x' (T_VARIABLE) in /in/Ik7Kf on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/Ik7Kf on line 10
Process exited with code 255.

preferences:
189.3 ms | 1386 KiB | 67 Q