Re: language question
| From: | Christian Reiniger | Date: | Mon, 22 Oct 2001 14:47:56 +0000 |
| Subject: | Re: language question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71833@lists.php.net to get a copy of this message | ||
On Monday 22 October 2001 14:28, David Otton wrote:
> why does this work:
>
> foreach ($table as $row)
> list ($a, $b) = $row;
>
> but this doesn't?
>
> foreach ($table as list ($a, $b));
because the correct syntax is
foreach ($table as $key => $val) {
...
}
RTFM :)
BTW: overwriting $a, $b in each iteration isn't particularly useful...
--
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)
Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.
- George Gordon Noel Byron (1788-1824), [Lord Byron]