3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str=<<<XML <control> <prop name='prop_id' value='panel_right_5'/> <prop name='prop_type' value='panel'/> <prop name='width' value='192px'/> <prop name='height' value='208px'/> <prop name='float' value='left'/> <prop name='margin-left' value='2px'/> <prop name='margin-top' value='1px'/> <controls> <control> <prop name='prop_id' value='0'/> <prop name='prop_type' value='button'/> <prop name='prop_style_class' value='estilo_panel_5'/> <prop name='prop_action' value='1'/> <prop name='prop_action_value' value='0'/> <prop name='prop_text1' value='0'/> <prop name='prop_text1_valign' value='middle'/> <prop name='prop_text1_halign' value='center'/> <prop name='width' value='62px'/> <prop name='height' value='50px'/> </control> <control> <prop name='prop_id' value='00'/> <prop name='prop_type' value='button'/> <prop name='prop_style_class' value='estilo_panel_5'/> <prop name='prop_action' value='46'/> <prop name='prop_action_value' value='00'/> <prop name='prop_text1' value='00'/> <prop name='prop_text1_valign' value='middle'/> <prop name='prop_text1_halign' value='center'/> <prop name='width' value='62px'/> <prop name='height' value='50px'/> </control> <control> <prop name='prop_id' value=','/> <prop name='prop_type' value='button'/> <prop name='prop_style_class' value='estilo_panel_5'/> <prop name='prop_action' value='1'/> <prop name='prop_action_value' value=','/> <prop name='prop_text1' value=','/> <prop name='prop_text1_valign' value='middle'/> <prop name='prop_text1_halign' value='center'/> <prop name='width' value='62px'/> <prop name='height' value='50px'/> </control> </controls> </control> XML; $xml=simplexml_load_string($str); $result=$xml->xpath("//control/prop[@name='prop_action'][@value]"); foreach($result as $control) { $parent_div = $control->xpath(".."); echo $parent_div[0]->asXML()."\n\n"; }
based on UGdrf
Output for 5.0.0 - 7.2.0
<control> <prop name="prop_id" value="0"/> <prop name="prop_type" value="button"/> <prop name="prop_style_class" value="estilo_panel_5"/> <prop name="prop_action" value="1"/> <prop name="prop_action_value" value="0"/> <prop name="prop_text1" value="0"/> <prop name="prop_text1_valign" value="middle"/> <prop name="prop_text1_halign" value="center"/> <prop name="width" value="62px"/> <prop name="height" value="50px"/> </control> <control> <prop name="prop_id" value="00"/> <prop name="prop_type" value="button"/> <prop name="prop_style_class" value="estilo_panel_5"/> <prop name="prop_action" value="46"/> <prop name="prop_action_value" value="00"/> <prop name="prop_text1" value="00"/> <prop name="prop_text1_valign" value="middle"/> <prop name="prop_text1_halign" value="center"/> <prop name="width" value="62px"/> <prop name="height" value="50px"/> </control> <control> <prop name="prop_id" value=","/> <prop name="prop_type" value="button"/> <prop name="prop_style_class" value="estilo_panel_5"/> <prop name="prop_action" value="1"/> <prop name="prop_action_value" value=","/> <prop name="prop_text1" value=","/> <prop name="prop_text1_valign" value="middle"/> <prop name="prop_text1_halign" value="center"/> <prop name="width" value="62px"/> <prop name="height" value="50px"/> </control>
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/7svKm on line 52
Process exited with code 255.
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/7svKm on line 52
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: simplexml_load_string() in /in/7svKm on line 53
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/7svKm on line 52