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 = $simpleXML->PricingInfoResults->PricingInfo->Term->xpath($xpathText)[0]; echo '<pre>Parent';$parent;echo '</pre>'; ;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: Undefined array key 0 in /in/jWiY0 on line 47 <pre>Parent</pre>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Undefined array key 0 in /in/jWiY0 on line 47 <pre>Parent</pre>
Output for 5.6.0 - 5.6.29, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
<pre>Parent</pre>

preferences:
212.51 ms | 402 KiB | 189 Q