<?php
class Animal {
}
$dog = new Animal();
$cat = new Animal();
$mouse = new Animal();
$spl = new SplObjectStorage();
$spl->attach($dog);
$spl->attach($cat);
$spl->attach($mouse);
foreach ($spl as $a) {
echo "Outer start\n";
foreach ($spl as $b) {
echo "Inner\n";
}
echo "Outer end\n";
}
PD9waHAKY2xhc3MgQW5pbWFsIHsKCn0KCiRkb2cgPSBuZXcgQW5pbWFsKCk7CiRjYXQgPSBuZXcgQW5pbWFsKCk7CiRtb3VzZSA9IG5ldyBBbmltYWwoKTsKCiRzcGwgPSBuZXcgU3BsT2JqZWN0U3RvcmFnZSgpOwoKJHNwbC0+YXR0YWNoKCRkb2cpOwokc3BsLT5hdHRhY2goJGNhdCk7CiRzcGwtPmF0dGFjaCgkbW91c2UpOwoKZm9yZWFjaCAoJHNwbCBhcyAkYSkgewoJZWNobyAiT3V0ZXIgc3RhcnRcbiI7CgkKCWZvcmVhY2ggKCRzcGwgYXMgJGIpIHsKCQllY2hvICJJbm5lclxuIjsKCX0KCQoJZWNobyAiT3V0ZXIgZW5kXG4iOwp9