1--TEST--
2SPL: ArrayObject::count() and ArrayIterator::count() basic functionality.
3--FILE--
4==ArrayObject==
5<?php
6class C extends ArrayObject {
7  function count(): int {
8    return 99;
9  }
10}
11
12$c = new C;
13$ao = new ArrayObject;
14
15var_dump(count($c), count($ao));
16
17$c[] = 'a';
18$ao[] = 'a';
19var_dump(count($c), count($ao));
20
21$c[] = 'b';
22$ao[] = 'b';
23var_dump(count($c), count($ao));
24
25unset($c[0]);
26unset($ao[0]);
27var_dump($c->count(), $ao->count());
28?>
29==ArrayIterator==
30<?php
31class D extends ArrayIterator {
32  function count(): int {
33    return 99;
34  }
35}
36
37$c = new D;
38$ao = new ArrayIterator;
39
40var_dump(count($c), count($ao));
41
42$c[] = 'a';
43$ao[] = 'a';
44var_dump(count($c), count($ao));
45
46$c[] = 'b';
47$ao[] = 'b';
48var_dump(count($c), count($ao));
49
50unset($c[0]);
51unset($ao[0]);
52var_dump($c->count(), $ao->count());
53?>
54--EXPECT--
55==ArrayObject==
56int(99)
57int(0)
58int(99)
59int(1)
60int(99)
61int(2)
62int(99)
63int(1)
64==ArrayIterator==
65int(99)
66int(0)
67int(99)
68int(1)
69int(99)
70int(2)
71int(99)
72int(1)
73