xref: /PHP-8.3/ext/simplexml/tests/036.phpt (revision 37a3c9bc)
1--TEST--
2SimpleXML: overridden count() method
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7class SXE extends SimpleXmlElement {
8    public function count(): int {
9        echo "Called Count!\n";
10        return parent::count();
11    }
12}
13
14$str = '<xml><c>asdf</c><c>ghjk</c></xml>';
15$sxe = new SXE($str);
16var_dump(count($sxe));
17?>
18--EXPECT--
19Called Count!
20int(2)
21