xref: /PHP-7.2/ext/spl/tests/dllist_008.phpt (revision 0eea0a05)
1--TEST--
2SPL: SplDoublyLinkedList with overriden count()
3--FILE--
4<?php
5$obj = new SplDoublyLinkedList();
6$obj[] = 1;
7$obj[] = 2;
8var_dump(count($obj));
9class SplDoublyLinkedList2 extends SplDoublyLinkedList{
10    public function count() {
11        return -parent::count();
12    }
13}
14$obj = new SplDoublyLinkedList2();
15$obj[] = 1;
16$obj[] = 2;
17var_dump(count($obj));
18?>
19--EXPECT--
20int(2)
21int(-2)
22