问题 When you have a foreach loop like below, I know that you can change the current element of the array through $array[$key] , but is there also a way to just change it through $value ? foreach($array as $key => $value){ } It's probably really simple, but I'm quite new to PHP so please don't be annoyed by my question :) 回答1: To be able to directly assign values to $value , you want to reference $value by preceding it with & like this: foreach($array as $key => &$value){ $value = 12321; //the