$array = array(1, 2, 3, 4);
foreach ($array as &$valor) {
$valor = $valor * 2;
}
// $array ahora es array(2, 4, 6, 8)
unset($valor); // rompe la referencia con el último elemento
I found the above in the php documentation on how to do a foreach
and put: &$valor
, but I don't understand what the &
before variable is for
Can someone tell me what it means?