Skip to content

Instantly share code, notes, and snippets.

@rightgo09
Created February 16, 2015 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rightgo09/4a26c87d1b3cc77f0d7c to your computer and use it in GitHub Desktop.
Save rightgo09/4a26c87d1b3cc77f0d7c to your computer and use it in GitHub Desktop.
<?php
$a = array(1,2,3);
$b = array(4,5,6);
foreach (array($a, &$b) as &$c) {
foreach ($c as &$d) {
$d *= 100;
}
}
print_r($a);
print_r($b);
//Array
//(
// [0] => 1
// [1] => 2
// [2] => 3
//)
//Array
//(
// [0] => 400
// [1] => 500
// [2] => 600
//)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment