- var_dump: documentation ( source)
<?php
class MyObjectStorage extends SplObjectStorage {
// Overwrite getHash() with just some (working) test-method
public function getHash($object) { return get_class($object); }
}
class TestObject {}
$list = new SplObjectStorage(); // No issues if using "new SplObjectStorage()"
$list->attach(new TestObject());
foreach($list as $x) var_dump($list->offsetExists($x)); // TRUE
$list2 = clone $list;
foreach($list2 as $x) var_dump($list2->offsetExists($x)); // FALSE