xref: /PHP-7.3/ext/simplexml/tests/034.phpt (revision ded3d984)
1--TEST--
2SimpleXML: cast to array
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
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