I am getting this error in PHP / ZF2:
Warning: Invalid argument supplied for foreach()
But I can render the form elements. Why I am getting this error in Zend framework 2 and How to resolve this error?
I am getting this error in PHP / ZF2:
Warning: Invalid argument supplied for foreach()
But I can render the form elements. Why I am getting this error in Zend framework 2 and How to resolve this error?
probably you are trying to loop throught a non-object or non-array variable
in case $foo
should be an object:
if(is_object($foo)){
foreach($foo as $element){
// ...
}
}
in case $foo
should be an array:
if(is_array($foo)){
foreach($foo as $element){
// ...
}
}
hope this helps