3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <exp:Input xmlns:exp="http://xps.com"> <exp:serviceId>namesurname</exp:serviceId> <exp:data> <exp:xml>coded</exp:xml> </exp:data> </exp:Input> </soapenv:Body> </soapenv:Envelope>'; $content = str_replace(['soapenv:', 'exp:'], '', $content); $xml = new SimpleXMLElement($content); $serviceId = $xml->Body->Input->serviceId; echo $serviceId;
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.16, 8.5.0 - 8.5.1
namesurname

preferences:
111.46 ms | 406 KiB | 5 Q