Skip to content

Instantly share code, notes, and snippets.

@arthurschreiber
Created February 19, 2012 22:48
Show Gist options
  • Save arthurschreiber/1866300 to your computer and use it in GitHub Desktop.
Save arthurschreiber/1866300 to your computer and use it in GitHub Desktop.
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
unset($value); // break the reference with the last element
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment