Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created October 13, 2014 11:30
Show Gist options
  • Save dstogov/25042425f8bafc8bc2df to your computer and use it in GitHub Desktop.
Save dstogov/25042425f8bafc8bc2df to your computer and use it in GitHub Desktop.
$ cat xx.php
<?php
$a = array(1=>2);
foreach ($a as $key => $val) {
$a[$key+1] = $val + 1;
}
var_dump($a);
$ sapi/cli/php xx.php
array(2) {
[1]=>
int(2)
[2]=>
int(3)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment