How to solve E_WARNING: Invalid argument supplied
for foreach()
?
for example:
This is the code
foreach ($response->myinterests as $key => $value) {
foreach($value as $val)
{
$inter[$key][].= $val;
}
}
I want to add condition not equals empty
if(!empty($response->myinterests)){
foreach ($response->myinterests as $key => $value) {
foreach($value as $val)
{
$inter[$key][].= $val;
}
}
}
Is this right?