Skip to content

Instantly share code, notes, and snippets.

@bakura10 bakura10/test.php
Last active Aug 29, 2015

Embed
What would you like to do?
<?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
You can’t perform that action at this time.