It often happens to me to handle data that can be either an array or a null variable and to feed some foreach with these data.
foreach
$values = get_val
What about defining an empty array as fallback if get_value() is empty? I can't think of a shortest way.
get_value()
$values = get_values() ?: []; foreach ($values as $value){ ... }