xref: /PHP-8.0/ext/simplexml/tests/011.phpt (revision c5401854)
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--EXPECT--
38===BAR===
39bar
40===BAZ===
41baz1
42===BAZ0===
43baz1
44===BAZ1===
45baz2
46