Last active
August 29, 2015 14:08
-
-
Save bakura10/6c52f5e00433f69142d6 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 | |
class Foo | |
{ | |
public function myMethod() | |
{ | |
$myData = []; | |
// MyData is filled with approximately 50-500 elements, but with a lot of attributes inside each element. | |
// BUT one of the property inside each element is an iterator. Therefore each element looks a bit like this: | |
/** | |
* $myData[] = [ | |
* 'property1' => 'value1', | |
* // ..., | |
* 'property200' => new ArrayIterator() | |
* ]; | |
*/ | |
$this->another($myData); | |
} | |
public function another(array $myData) | |
{ | |
// $myData is always iterated and accessed, but never modified. But what happen when the property with the | |
// iterator is accessed and itself iterated? Does it trigger a copy of the array? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment