xref: /PHP-7.3/ext/simplexml/tests/011.phpt (revision 782352c5)
1--TEST--
2SimpleXML: echo/print
3--SKIPIF--
4<?php
5	if (!extension_loaded('simplexml')) print 'skip';
6?>
7--FILE--
8<?php
9
10$xml =<<<EOF
11<?xml version="1.0" encoding="ISO-8859-1" ?>
12<foo>
13  <bar>bar</bar>
14  <baz>baz1</baz>
15  <baz>baz2</baz>
16</foo>
17EOF;
18
19$sxe = simplexml_load_string($xml);
20
21echo "===BAR===\n";
22echo $sxe->bar;
23echo "\n";
24
25echo "===BAZ===\n";
26echo $sxe->baz;
27echo "\n";
28
29echo "===BAZ0===\n";
30echo $sxe->baz[0];
31echo "\n";
32
33echo "===BAZ1===\n";
34print $sxe->baz[1];
35echo "\n";
36?>
37===DONE===
38--EXPECT--
39===BAR===
40bar
41===BAZ===
42baz1
43===BAZ0===
44baz1
45===BAZ1===
46baz2
47===DONE===
48