jcadima
12/17/2015 - 7:55 PM

Invalid argument supplied for foreach(), FIX

Invalid argument supplied for foreach(), FIX

ref:http://stackoverflow.com/questions/2630013/invalid-argument-supplied-for-foreach/2630032#2630032

<?php
// wrap your foreach inside this if statement
if (is_array($values) || is_object($values))
{
    foreach ($values as $value)
    {
        ...
    }
}


// Note that if some objects are iterable, use:
if (is_array($values) || $values instanceof Traversable)