Re: Surpressing a 'foreach' Error Message
| From: | Chris Edwards | Date: | Fri, 06 Feb 2004 23:11:36 +0000 |
| Subject: | Re: Surpressing a 'foreach' Error Message | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177061@lists.php.net to get a copy of this message | ||
The is_array will still give a warning is the variable array does not exist.
Use isset()
----- Original Message -----
From: "craig" <php@lonsbury.com>
To: <php-general@lists.php.net>
Sent: Friday, February 06, 2004 5:35 PM
Subject: RE: [PHP] Surpressing a 'foreach' Error Message
> > craig <mailto:php@lonsbury.com>
> > on Friday, February 06, 2004 2:24 PM said:
> >
> > > if (is_array($project))
> > > foreach ($project as $project_id => $value) {
> > > $fields[] = $project_id;
> > > $values[] = $value;
> > > }
> > > }
> >
> > you're missing a curly brace after the if ().
> >
>
> my bad, that's what you get when you don't actually
> run the code. Thank god for compilers ;)
>
> -Craig
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>