PHP – Ampersand before the variable in foreach loop [duplicate]
This example will show you the difference $array = array(1, 2); foreach ($array as $value) { $value++; } print_r($array); // 1, 2 because we iterated over copy of value foreach ($array as &$value) { $value++; } print_r($array); // 2, 3 because we iterated over references to actual values of array Check out the PHP docs … Read more