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
How about this one? lot cleaner and all in single line.
foreach ((array) $items as $item) { // ... }