xref: /PHP-8.2/ext/simplexml/tests/020.phpt (revision 7f2f0c00)
1--TEST--
2SimpleXML: Attribute compared to string
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8$doc = simplexml_load_string('<root><name attr="foo">bar</name></root>');
9print $doc->name["attr"];
10print "\n";
11if ($doc->name["attr"] == "foo") {
12         print "Works\n";
13} else {
14         print "Error\n";
15}
16?>
17--EXPECT--
18foo
19Works
20