xref: /PHP-8.1/ext/simplexml/tests/034.phpt (revision 7f2f0c00)
1--TEST--
2SimpleXML: cast to array
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7$string = '<?xml version="1.0"?>
8<foo><bar>
9   <p>Blah 1</p>
10   <p>Blah 2</p>
11   <p>Blah 3</p>
12   <tt>Blah 4</tt>
13</bar></foo>
14';
15$foo = simplexml_load_string($string);
16$p = $foo->bar->p;
17echo count($p);
18$p = (array)$foo->bar->p;
19echo count($p);
20?>
21--EXPECT--
2233
23