#!/usr/bin/env php
<?php
$items = array();
for ($i = 0; $i < 5; $i++) {
$items[] = array(
'id' => $i,
);
}
foreach ($items as &$item) {}
print_r($items);
foreach ($items as $item) {
echo "PROCESSING => {$item['id']}\n";
}
$ ./test.php
Array
(
[0] => Array
(
[id] => 0
)
[1] => Array
(
[id] => 1
)
[2] => Array
(
[id] => 2
)
[3] => Array
(
[id] => 3
)
[4] => Array
(
[id] => 4
)
)
PROCESSING => 0
PROCESSING => 1
PROCESSING => 2
PROCESSING => 3
PROCESSING => 3
Что происходит в последней итерации последнего foreach?