Skip to content

Instantly share code, notes, and snippets.

@bakura10
Last active August 29, 2015 14:08
Show Gist options
  • Save bakura10/6c52f5e00433f69142d6 to your computer and use it in GitHub Desktop.
Save bakura10/6c52f5e00433f69142d6 to your computer and use it in GitHub Desktop.
<?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