Hi guys,
any idea why
foreach ($groups as &$group)
$group = trim(str_replace(',', '', $group));
echo '<pre>';
print_r($groups);
echo '</pre>';
$groupsq = $groups;
foreach ($groupsq as &$group)
$group = '\'' . $group . '\'';
echo '<pre>';
print_r($groups);
echo '</pre>';
Yields
Array
(
[0] => Fake group
[1] => another group
[2] => non-existent
)
Array
(
[0] => Fake group
[1] => another group
[2] => 'non-existent'
)
The part i am interested in is,
Why does the second array modification effect the last item on the first array?