xref: /PHP-7.2/ext/simplexml/tests/030.phpt (revision 17ccbeec)
1--TEST--
2SimpleXML: isset and unset by offset
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
5--FILE--
6<?php
7$xml =<<<EOF
8<root s:att1="b" att1="a"
9      xmlns:s="urn::test" xmlns:t="urn::test-t">
10   <child1>test</child1>
11   <child1>test 2</child1>
12   <s:child3 />
13</root>
14EOF;
15
16$sxe = simplexml_load_string($xml);
17
18echo $sxe->child1[0]."\n";
19echo $sxe->child1[1]."\n\n";
20
21var_dump(isset($sxe->child1[1]));
22unset($sxe->child1[1]);
23var_dump(isset($sxe->child1[1]));
24echo "\n";
25
26$atts = $sxe->attributes("urn::test");
27var_dump(isset($atts[0]));
28unset($atts[0]);
29var_dump(isset($atts[0]));
30var_dump(isset($atts[TRUE]));
31
32?>
33===DONE===
34--EXPECT--
35test
36test 2
37
38bool(true)
39bool(false)
40
41bool(true)
42bool(false)
43bool(false)
44===DONE===
45