Answers for "invalid argument supplied for foreach()"

PHP
2

invalid argument supplied for foreach()

<?php
if (is_array($array) || is_object($array))
{
    foreach ($array as $row)
    {
        ...
    }
}
?>
Posted by: Guest on March-04-2021
0

Invalid argument supplied for foreach() in C

$array = ['dog', 'cat', 'lion'];

if (!empty($array) && isset($array) && is_array($array) {
    //loop
    foreach ($array as $values) {
        echo $values; 
    }
}
Posted by: Guest on July-10-2021

Code answers related to "invalid argument supplied for foreach()"

Browse Popular Code Answers by Language