3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = '<artists page="1" perPage="100" totalPages="253081" total="25308020"> <artist> <name>David Bowie</name> <playcount>151727648</playcount> <listeners>3969219</listeners> <mbid>5441c29d-3602-4898-b1a1-b77fa23b8e50</mbid> <url>http://www.last.fm/music/David+Bowie</url> <streamable>0</streamable> <image size="small"> http://img2-ak.lst.fm/i/u/34s/937d62bb145040b9b709319c1e680037.png </image> <image size="medium"> http://img2-ak.lst.fm/i/u/64s/937d62bb145040b9b709319c1e680037.png </image> <image size="large"> http://img2-ak.lst.fm/i/u/174s/937d62bb145040b9b709319c1e680037.png </image> <image size="extralarge"> http://img2-ak.lst.fm/i/u/300x300/937d62bb145040b9b709319c1e680037.png </image> <image size="mega"> http://img2-ak.lst.fm/i/u/937d62bb145040b9b709319c1e680037.png </image> </artist> <artist> <name>The Beatles</name> <playcount>456495139</playcount> <listeners>3986977</listeners> <mbid>b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d</mbid> <url>http://www.last.fm/music/The+Beatles</url> <streamable>0</streamable> <image size="small"> http://img2-ak.lst.fm/i/u/34s/55efc33bcd234fd8a1d65b3d49bf9661.png </image> <image size="medium"> http://img2-ak.lst.fm/i/u/64s/55efc33bcd234fd8a1d65b3d49bf9661.png </image> <image size="large"> http://img2-ak.lst.fm/i/u/174s/55efc33bcd234fd8a1d65b3d49bf9661.png </image> <image size="extralarge"> http://img2-ak.lst.fm/i/u/300x300/55efc33bcd234fd8a1d65b3d49bf9661.png </image> <image size="mega"> http://img2-ak.lst.fm/i/u/55efc33bcd234fd8a1d65b3d49bf9661.png </image> </artist> </artists>'; $doc = new DOMDocument(); $doc->loadXML($xml, LIBXML_PARSEHUGE); $artists = $doc->getElementsByTagName('artist'); foreach($artists as $artist) { $name = $artist>getElementsByTagName('name')->item(0)->nodeValue; var_dump($name); }
based on QjSCi
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function getElementsByTagName() in /in/1W0uQ:56 Stack trace: #0 {main} thrown in /in/1W0uQ on line 56
Process exited with code 255.
Output for 5.3.22 - 5.6.28
Fatal error: Call to undefined function getElementsByTagName() in /in/1W0uQ on line 56
Process exited with code 255.