How can variables be manipulated within a foreach loop in PHP?

Variables within a foreach loop in PHP can be manipulated by passing them by reference using the `&` symbol before the variable name. This allows changes made to the variable within the loop to persist outside of the loop. By using this method, the variable can be modified directly within the loop without needing to reassign it.

$numbers = [1, 2, 3, 4, 5];
foreach ($numbers as &$number) {
    $number *= 2;
}
unset($number); // unset the reference to avoid potential issues
print_r($numbers);