Created
December 9, 2015 22:47
-
-
Save carlbennett/86dc1663ba97dfdc5952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
function closure_test(&$foobar) { | |
// Repeat for some arbitrary number of executions | |
$x = mt_rand(3, 10); | |
while ($x > 0) { | |
$foobar[] = $x; | |
--$x; | |
} | |
$closure = function(&$foobar) { | |
$foobar[mt_rand(0, count($foobar) - 1)] = "this row got changed!"; | |
}; | |
$closure($foobar); | |
} | |
$foobar = []; | |
closure_test($foobar); | |
print_r($foobar); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment