3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml=simplexml_load_string(<<<XML <item id="1991901" > <property name="image"> <property> <property name="image_realtyimagetype_id"> <value>yleiskuva</value> </property> <property name="image_itemimagetype_name"> <value>kivirealty-original</value> </property> <property name="image_desc"> <value></value> </property> <property name="image_url"> <value>http://domain.com/img4092288730864152376.jpg</value> </property> </property> <property> <property name="image_realtyimagetype_id"> <value>pääkuva</value> </property> <property name="image_itemimagetype_name"> <value>kivirealty-original</value> </property> <property name="image_desc"> <value></value> </property> <property name="image_url"> <value>http://domain.com/imgthisiwant.jpg</value> </property> </property> </property> </item> XML ); $path = '//item[@id="1991901"]/property[@name="image"]/property[//property[@name="image_realtyimagetype_id"]/value/text()="pääkuva"]/property[@name="image_url"]/value/text()'; $image_url = $xml->xpath($path); $image_url = $image_url[0]; echo $image_url;
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
http://domain.com/img4092288730864152376.jpg
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/8uvrE on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/8uvrE on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/8uvrE on line 2