xref: /PHP-8.2/ext/spl/tests/observer_008.phpt (revision 6d805ed2)
1--TEST--
2SPL: SplObjectStorage addAll/removeAll
3--FILE--
4<?php
5class A extends SplObjectStorage { }
6
7$o1 = new StdClass;
8$o2 = new StdClass;
9$o3 = new StdClass;
10
11$a = new A;
12$a->attach($o1);
13$a->attach($o2);
14
15$b = new SplObjectStorage();
16$b->attach($o2);
17$b->attach($o3);
18
19$a->addAll($b);
20
21var_dump($a->count());
22
23$a->detach($o3);
24var_dump($a->count());
25
26$a->removeAll($b);
27var_dump($a->count());
28?>
29--EXPECT--
30int(3)
31int(2)
32int(1)
33