xref: /PHP-8.0/ext/simplexml/tests/profile07.phpt (revision cb7e9011)
1--TEST--
2SimpleXML [profile]: Accessing an aliased namespaced attribute
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
5--FILE--
6<?php
7error_reporting(E_ALL & ~E_NOTICE);
8$root = simplexml_load_string('<?xml version="1.0"?>
9<root xmlns:reserved="reserved-ns">
10 <child reserved:attribute="Sample" />
11</root>
12');
13
14$rsattr = $root->child->attributes('reserved');
15$myattr = $root->child->attributes('reserved-ns');
16
17echo $rsattr['attribute'];
18echo $myattr['attribute'];
19echo "\n---Done---\n";
20?>
21--EXPECT--
22Sample
23---Done---
24