xref: /php-src/ext/simplexml/tests/profile11.phpt (revision 7f2f0c00)
1--TEST--
2SimpleXML [profile]: Accessing two elements with the same name, but different namespaces
3--EXTENSIONS--
4simplexml
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" xmlns:special="special-ns">
10 <reserved:child>Hello</reserved:child>
11 <special:child>World</special:child>
12</root>
13');
14
15var_dump($root->children('reserved-ns')->child);
16var_dump($root->children('special-ns')->child);
17var_dump((string)$root->children('reserved-ns')->child);
18var_dump((string)$root->children('special-ns')->child);
19var_dump($root->child);
20?>
21--EXPECTF--
22object(SimpleXMLElement)#%d (1) {
23  [0]=>
24  string(5) "Hello"
25}
26object(SimpleXMLElement)#%d (1) {
27  [0]=>
28  string(5) "World"
29}
30string(5) "Hello"
31string(5) "World"
32object(SimpleXMLElement)#%d (0) {
33}
34