Created
July 14, 2016 10:44
-
-
Save NamelessCoder/92b9a74b5c0f81b34ddcc42826614442 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 | |
$test = new ArrayIterator(array(1, 2, 3)); | |
$exec = []; | |
foreach ($test as $l1) { | |
$exec[] = 'outer ' . $l1; | |
foreach ($test as $l2) { | |
$exec[] = 'inner' . $l2; | |
} | |
} | |
var_dump($exec); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://php.net/manual/en/control-structures.foreach.php sort of explains why, and details a possible difference in PHP 5 and 7. I quote:
http://php.net/manual/en/control-structures.foreach.php
The documentation page originally also stated that:
Whether that still applies is not certain but from the example above, it would appear so.