Re: Should this work?
| From: | Richard Lynch | Date: | Fri, 09 Feb 2001 02:57:19 +0000 |
| Subject: | Re: Should this work? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38890@lists.php.net to get a copy of this message | ||
> foreach($some2DArray as &$refToArrayRow)
> {
> }
>
> It won't even parse with an error of
> <b>Parse error</b>: parse error, expecting
T_VARIABLE' or
> '$'' in
> <b>./myFile.php</b> on line <b>473</b><br>
>
>
> Can you not use a reference within a foreach loop? With the & removed,
> it works fine but then when I update the $refToArrayRow it's (obviously)
> not updating the original $some2DArray....
Maybe try with the & on the $some2DArray instead...
I mean, you want a reference to the 2D Array so you can munge it, right?
So, like, then you are doing the assignment of &$some2DArray to a new
variable not unlike:
$arrayRow = &$some2DArray[0];
Or am I the one that is thinking backwards?
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm