Re: Strange foreach reference issue
| From: | Matijn Woudt | Date: | Sun, 08 Jan 2012 00:18:24 +0000 |
| Subject: | Re: Strange foreach reference issue | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316215@lists.php.net to get a copy of this message | ||
On Sun, Jan 8, 2012 at 12:29 AM, Tim Behrendsen <tim@behrendsen.com> wrote:
> Hello,
>
> This sure looks like a bug, but maybe there's some subtlety going on that I
> don't understand, so I would appreciate some insight. After much debugging,
> I tracked down a bug in my code to this test program. My PHP version is
> 5.3.3, running under Fedora Linux.
>
> <?php
> $row_list = array(
> array(
> 'Title' => 'Title #1',
> ),
> array(
> 'Title' => 'Title #2',
> ),
> array(
> 'Title' => 'Title #3',
> ) );
>
> print " Rows at start: " . print_r($row_list, true);
> foreach ($row_list as $idx => &$row) {
Why is there an '&' before $row here? That seems like the problem to me..
Matijn