Last active
February 10, 2017 10:23
-
-
Save gilbitron/5020cb89a85f66075d2a4e0128d14631 to your computer and use it in GitHub Desktop.
Revisions
-
gilbitron revised this gist
Feb 10, 2017 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ (function() use ($array) { // Add an item to the array $array[] = 'item'; })(); var_dump($array); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,8 @@ $array = []; (function() use (&$array) { // Notice the pass by reference // Add an item to the array $array[] = 'item'; })(); var_dump($array); -
gilbitron revised this gist
Feb 10, 2017 . 2 changed files with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,11 +2,10 @@ $array = []; (function() use ($array) { // Add an item to the array $array[] = 'item'; })(); var_dump($array); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,11 +2,10 @@ $array = []; (function() use (&$array) { // Notice the pass by reference // Add an item to the array $array[] = 'item'; })(); var_dump($array); -
gilbitron created this gist
Feb 10, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ <?php $array = []; $example = function() use ($array) { // Add an item to the array $array[] = 'item'; }; $example(); var_dump($array); /* * Output: * * array(0) { * } * */ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ <?php $array = []; $example = function() use (&$array) { // Notice the pass by reference // Add an item to the array $array[] = 'item'; }; $example(); var_dump($array); /* * Output: * * array(1) { * [0] => string(4) "item" * } * */