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"; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
179.24 ms | 1731 KiB | 10 Q