3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = '<extData> <orderData> <order><orderId>6</orderId><orderTime>2014-10-23T02:53:38</orderTime><item><sku>138</sku><title>Beef Pie</title><quantity>1</quantity><price>8.00</price><amount>8.00</amount></item><item><sku>138</sku><title>Beef Pie</title><quantity>-1</quantity><price>8.00</price><amount>-8.00</amount></item><subtotal>0.00</subtotal><fee>0.00</fee><total>0.00</total><orderStatus>COMP</orderStatus></order><schema_version>2</schema_version> </orderData> </extData><price>±'; if(preg_match('/<extData>(.*)<\/extData>/s',$x, $matches)) { $xml = simplexml_load_string($matches[0]); $code = $xml->xpath('//APCurrency'); echo $code[0]; } //var_dump($matches);
based on WYGnE
Output for 5.3.0 - 7.1.0
Notice: Undefined offset: 0 in /in/WQ2WK on line 12
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.2.17
Notice: Undefined offset: 0 in /in/WQ2WK on line 12
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/WQ2WK on line 14
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/WQ2WK on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/WQ2WK on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/WQ2WK on line 10