Skip to content

Instantly share code, notes, and snippets.

@iakio
Created September 13, 2010 07:00
Show Gist options
  • Save iakio/576914 to your computer and use it in GitHub Desktop.
Save iakio/576914 to your computer and use it in GitHub Desktop.
<?php
$arr = array(1);
function &a() {
global $arr;
return $arr[];
}
var_dump(a(), $arr);
var_dump(a(), $arr);
var_dump(a(), $arr);
//----
NULL
array(2) {
[0]=>
int(1)
[1]=>
NULL
}
NULL
array(3) {
[0]=>
int(1)
[1]=>
NULL
[2]=>
NULL
}
NULL
array(4) {
[0]=>
int(1)
[1]=>
NULL
[2]=>
NULL
[3]=>
NULL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment