Created
January 18, 2014 13:27
-
-
Save asm89/8490526 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
<?php | |
$xs = array(42); | |
foreach ($xs as $x) {} | |
var_dump(current($xs)); | |
$ys = array(42); | |
foreach ($ys as &$y) {} | |
var_dump(current($ys)); | |
$it = new ArrayIterator([42]); | |
foreach($it as $i){} | |
var_dump($it->current()); | |
$it2 = (new ArrayObject([42]))->getIterator(); | |
foreach($it2 as $i){} | |
var_dump($it2->current()); |
Author
asm89
commented
Jan 18, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment