3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting (E_ALL ^ E_NOTICE); ini_set('display_errors',true); $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <Whirlpool xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <PricingInfoResults> <RequestResults> <RequestDate>1/5/2017</RequestDate> <RequestTime>8:35 AM</RequestTime> <ReturnInfo> <ReturnInfoCode>1000</ReturnInfoCode> <ReturnInfoDesc>Promo code found</ReturnInfoDesc> </ReturnInfo> </RequestResults> <PricingInfo> <ProductDesc>Icemaker</ProductDesc> <CampaignCode>WRLPIO1612</CampaignCode> <CMICode>WR1612WEB</CMICode> <MCMCode>WHIRLPOOLWBOX</MCMCode> <RowId>1309467.00</RowId> <Term> <TermDesc>1 Year</TermDesc> <PaymentOption> <OptionDesc>Full Pay</OptionDesc> <Price>94.95</Price> <ProductIndicator>WD</ProductIndicator> </PaymentOption> </Term> <Term> <TermDesc>3 Year</TermDesc> <PaymentOption> <OptionDesc>Full Pay</OptionDesc> <Price>244.95</Price> <ProductIndicator>WE</ProductIndicator> </PaymentOption> </Term> </PricingInfo> </PricingInfoResults> </Whirlpool> XML; $simpleXML = simplexml_load_string($xml); $xpathText = '/Term/TermDesc'; $parent = (string)$simpleXML->PricingInfoResults->PricingInfo->Term->xpath($xpathText)[0]; echo '<pre>Parent';$parent;echo '</pre>'; ;

preferences:
51.94 ms | 402 KiB | 5 Q