Talk:Invalid argument supplied for foreach

From Php

Jump to: navigation, search

hi there !

this article is very well written and direct, congratulations for the author; BTW, i am correcting a missing end bracket ")" in the following:


function foo($anArray)
 {
   if(empty($anArray) ***** here !!!
   {
     return false;
   }
   foreach($anArray as $element)
   {
     echo $element;
   }
   return true;
 }

so the correct should be:

function foo($anArray)
 {
   if(empty($anArray))
   {
     return false;
   }
   foreach($anArray as $element)
   {
     echo $element;
   }
   return true;
 }

that caused a parse error before correction ....

bye !

--Henriquejf 11:27, 2 July 2008 (PDT)

Thank you for fixing the error! Jim DeLaHunt 16:23, 2 July 2008 (PDT)