xref: /PHP-8.1/ext/spl/tests/observer_009.phpt (revision a555cc0b)
1--TEST--
2SPL: SplObjectStorage addAll/removeAll
3--FILE--
4<?php
5class Foo {}
6
7$storageA = new \SplObjectStorage();
8$storageA->attach(new \Foo);
9$storageA->attach(new \Foo);
10
11echo ("Count storage A: " . count($storageA));
12foreach ($storageA as $object) {
13        echo ' x ';
14}
15
16echo "\n";
17$storageB = clone $storageA;
18
19echo ("Count storage B: " . count($storageB));
20foreach ($storageB as $object) {
21        echo ' x ';
22}
23echo "\n";
24?>
25--EXPECT--
26Count storage A: 2 x  x
27Count storage B: 2 x  x
28