3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $writer = new SimpleXMLElement('<?xml version="1.0"?><MessageHeader><MessageThreadId>0000000022</MessageThreadId><MessageId>000000002201</MessageId><MessageSender><PartyId>PADPIDA2010071901R</PartyId><PartyName><FullName>RHAPSODY INTERNATIONAL, INC.</FullName></PartyName><TradingName>Premier Extra</TradingName></MessageSender><MessageRecipient><PartyId>SWAPFORSOCIETYID</PartyId><PartyName><FullName>SWAPFORSOCIETYNAME</FullName></PartyName></MessageRecipient><MessageCreatedDateTime>2014-06-30T09:35:57</MessageCreatedDateTime></MessageHeader>'); $messagerecipient = $writer->xpath('MessageRecipient'); //foreach($messagerecipient as $data){ //$data->PartyID = '1234'; //} //$output = $writer->asXML(); //echo $output; var_dump($messagerecipient); ?>
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(1) { [0]=> object(SimpleXMLElement)#2 (2) { ["PartyId"]=> string(16) "SWAPFORSOCIETYID" ["PartyName"]=> object(SimpleXMLElement)#3 (1) { ["FullName"]=> string(18) "SWAPFORSOCIETYNAME" } } }
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/02iiH on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/02iiH on line 2