3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &test($a) { $empty = array(); return isset($a) ? $a : $empty; } function &test2($a) { $empty = []; if (isset($a)) { return $a; } else { return $empty; } } $test =& test('123'); print_r($test); $test =& test2('123'); print_r($test); $test =& test(NULL); print_r($test); $test =& test2(NULL); print_r($test);

preferences:
41.76 ms | 402 KiB | 5 Q