To change values in a multi-dimensional array while looping through:
$var=array('a'=>array(1,2,3),'b'=>array(4,5,6));
foreach ($var as &$sub) {
foreach ($sub as &$element) {
$element=$element+1;
}
}
var_dump($var);
------------------------------
produces:
------------------------------
array(2) {
["a"]=>
array(3) {
[0]=>
int(2)
[1]=>
int(3)
[2]=>
int(4)
}
["b"]=>
array(3) {
[0]=>
int(5)
[1]=>
int(6)
[2]=>
int(7)
}
}