3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $page = '<div class="showtime-bg"> <div style="float:left;"> <a href="javascript:getinfo(295, 1)"><img src="images/main/movies/movie.jpg" height="180" alt=""></a></div>'; $dom = new DOMDocument(); $dom->loadHTML($page); $xpath = new DOMXPath($dom); echo $xpath->query("//div[@class='showtime-bg']/img")->item(0)->getAttribute('src');
based on B54sv
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to a member function getAttribute() on null in /in/6LPdO:10 Stack trace: #0 {main} thrown in /in/6LPdO on line 10
Process exited with code 255.
Output for 5.6.8 - 5.6.21
Fatal error: Call to a member function getAttribute() on null in /in/6LPdO on line 10
Process exited with code 255.
Output for 5.3.20 - 5.5.35
Fatal error: Call to a member function getAttribute() on a non-object in /in/6LPdO on line 10
Process exited with code 255.