<?php
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
<title>PHP: Behind the Parser</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El ActÓr</actor>
</character>
</characters>
<plot>
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.
</plot>
<great-lines>
<line>PHP solves all my web problems</line>
</great-lines>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
</movies>
XML;
$parsed = simplexml_load_string($xml);
$foo = $parsed->movies->movie->foo->bar->baz;
var_dump($foo);
?>
Warning: Undefined variable $xml in /in/YPUBi on line 30
Deprecated: simplexml_load_string(): Passing null to parameter #1 ($data) of type string is deprecated in /in/YPUBi on line 30
Warning: Attempt to read property "movies" on false in /in/YPUBi on line 32
Warning: Attempt to read property "movie" on null in /in/YPUBi on line 32
Warning: Attempt to read property "foo" on null in /in/YPUBi on line 32
Warning: Attempt to read property "bar" on null in /in/YPUBi on line 32
Warning: Attempt to read property "baz" on null in /in/YPUBi on line 32
NULL
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Undefined variable $xml in /in/YPUBi on line 30
Deprecated: simplexml_load_string(): Passing null to parameter #1 ($data) of type string is deprecated in /in/YPUBi on line 30
Warning: Attempt to read property "movies" on bool in /in/YPUBi on line 32
Warning: Attempt to read property "movie" on null in /in/YPUBi on line 32
Warning: Attempt to read property "foo" on null in /in/YPUBi on line 32
Warning: Attempt to read property "bar" on null in /in/YPUBi on line 32
Warning: Attempt to read property "baz" on null in /in/YPUBi on line 32
NULL
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $xml in /in/YPUBi on line 30
Warning: Attempt to read property "movies" on bool in /in/YPUBi on line 32
Warning: Attempt to read property "movie" on null in /in/YPUBi on line 32
Warning: Attempt to read property "foo" on null in /in/YPUBi on line 32
Warning: Attempt to read property "bar" on null in /in/YPUBi on line 32
Warning: Attempt to read property "baz" on null in /in/YPUBi on line 32
NULL
Notice: Undefined variable: xml in /in/YPUBi on line 30
Notice: Trying to get property 'movies' of non-object in /in/YPUBi on line 32
Notice: Trying to get property 'movie' of non-object in /in/YPUBi on line 32
Notice: Trying to get property 'foo' of non-object in /in/YPUBi on line 32
Notice: Trying to get property 'bar' of non-object in /in/YPUBi on line 32
Notice: Trying to get property 'baz' of non-object in /in/YPUBi on line 32
NULL
Notice: Undefined variable: xml in /in/YPUBi on line 30
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
NULL
Output for 5.1.2
Notice: Undefined variable: xml in /in/YPUBi on line 31
Notice: Trying to get property of non-object in /in/YPUBi on line 33
Notice: Trying to get property of non-object in /in/YPUBi on line 33
Notice: Trying to get property of non-object in /in/YPUBi on line 33
Notice: Trying to get property of non-object in /in/YPUBi on line 33
Notice: Trying to get property of non-object in /in/YPUBi on line 33
NULL
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: xml in /in/YPUBi on line 30
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
Notice: Trying to get property of non-object in /in/YPUBi on line 32
NULL
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/YPUBi on line 30
Process exited with code 255.