Created
December 4, 2014 18:34
-
-
Save dduleone/d34c86b2961ebdf9cf90 to your computer and use it in GitHub Desktop.
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 characters
| <?php | |
| $sets = array(); | |
| $fruit = array('apples', 'grapes'); | |
| $numbers = array('one', 'two', 'three'); | |
| $sets[] = &$fruit; | |
| $sets[] = &$numbers; | |
| $fruit[] = 'banana'; | |
| $numbers[] = 'four'; | |
| $sets[] = &$sets[count($sets)-1]; | |
| $sets[] = end($sets); | |
| $numbers[] = 'five'; | |
| foreach($sets as $set) { | |
| var_dump($set); | |
| } |
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 characters
| array(3) { | |
| [0]=> | |
| string(6) "apples" | |
| [1]=> | |
| string(6) "grapes" | |
| [2]=> | |
| string(6) "banana" | |
| } | |
| array(5) { | |
| [0]=> | |
| string(3) "one" | |
| [1]=> | |
| string(3) "two" | |
| [2]=> | |
| string(5) "three" | |
| [3]=> | |
| string(4) "four" | |
| [4]=> | |
| string(4) "five" | |
| } | |
| array(5) { | |
| [0]=> | |
| string(3) "one" | |
| [1]=> | |
| string(3) "two" | |
| [2]=> | |
| string(5) "three" | |
| [3]=> | |
| string(4) "four" | |
| [4]=> | |
| string(4) "five" | |
| } | |
| array(4) { | |
| [0]=> | |
| string(3) "one" | |
| [1]=> | |
| string(3) "two" | |
| [2]=> | |
| string(5) "three" | |
| [3]=> | |
| string(4) "four" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment