xref: /PHP-8.3/ext/spl/tests/array_024.phpt (revision c6357b80)
1--TEST--
2SPL: ArrayObject with overridden count()
3--FILE--
4<?php
5$obj = new ArrayObject(array(1,2));
6var_dump(count($obj));
7class ArrayObject2 extends ArrayObject {
8    public function count(): int {
9        return -parent::count();
10    }
11}
12$obj = new ArrayObject2(array(1,2));
13var_dump(count($obj));
14?>
15--EXPECT--
16int(2)
17int(-2)
18