The problem occurs when you try to pass a variable $valueas a reference. You can achieve the desired result by changing the cycle foreachto look like this:
foreach($items as $key => $value){
if ($key == $testitem){
$items[$key] = $value + $testvalue;
}
}
$key $testitem, , $items - , .