3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['a' => 1, 'c' => 0]; function neverEmpty(&$firstChoice, $alternative) { return empty($firstChoice) ? $alternative : $firstChoice; } foreach (['a', 'b', 'c'] as $k) { var_export(neverEmpty($array[$k], 'nope')); echo "\n"; }

preferences:
59.66 ms | 1108 KiB | 5 Q