Modify arrays in form alter
Like PHP documentation says:
In order to be able to directly modify array elements within the loop precede $value with &amp;. In that case the value will be assigned by reference.

&lt;?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &amp;$value) {
    $value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
unset($value); // break the reference with the last element
?&gt;


http://php.net/manual/en/control-structures.foreach.php