Created by Andy ShellamLinked to 94.7m issues across 297 teams
If you are trying to use a foreach loop, it's important to make sure that the argument you're supplying is valid.
Here's how to check if the argument is an array or an object:
if (is_array($values) || is_object($values)) { // Argument is valid, proceed with foreach loop foreach ($values as $value) { // Code to be executed in the loop } }