>I would expect foreach to treat an unitialized variable as an empty
>array and hence do nothing. Is this the expected behaviour?

>if(is_array($myvar)) foreach($myvar as $key => $value ) {
>  ...
>}

other possibility, so that the foreach is run each time (and it doesn't
affect the source code, you can put it wherever you want) :
if(!is_array($myvar)) {
    $myvar = array();
}

regards !

Eric




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to