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