veraswanee
New Member
I am missing something obvious. Here's a trivial piece of PHP, littered with debug echos:\[code\]function echo_rows(&$res) { $rows= array(); while ($row= $res->fetch()) { echo $row['ccorID'] . "\r\n"; $rows[]= $row; echo $rows[0]['ccorID'] . "\r\n"; } echo "---.---\r\n"; echo count($rows) . "\r\n"; foreach($rows as $row) { echo $row['ccorID'] . "\r\n"; } echo json_encode($rows);}\[/code\]Here's what I see in the response:\[code\]00331313182182---.---4182182182182\[/code\]It seems perfectly clear to me that :-
- I have 4 rows of data
- \[code\]$rows[]= $row;\[/code\] does NOT perform a value copy, despite what it says here http://uk.php.net/manual/en/language.types.array.php