3v4l.org

run code in 300+ PHP versions simultaneously
<?php if( !function_exists('simplexml_load_string') || !function_exists('json_encode') ) die('Not supported yet'); $data = array( <<<XML <Hotels1> <Hotel> <Mapper><ProviderSupplierName/></Mapper> </Hotel> </Hotels1> XML , <<<XML <Hotels1> <Hotel> <Mapper> <ProviderSupplierName/> </Mapper> </Hotel> </Hotels1> XML ); foreach($data as $resultXML){ echo $resultXML . PHP_EOL; $sxml = simplexml_load_string($resultXML); echo json_encode($sxml,LIBXML_NOBLANKS); echo PHP_EOL; }

preferences:
44.16 ms | 402 KiB | 5 Q