how about this? It's more concise and it's all in one line.
foreach ((array) $items as $item) { // ... }
Personally, I think this is the cleanest - not sure if it's the most effective, mind you!
if (is_array($values) || is_object($values)) { foreach ($values as $value) { ... } }
The reason for my preference is that it doesn't allocate an empty array when you don't have anything to begin with.