3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <cfdi:Comprobante Version="3.3" Total="45264.13"> <cfdi:Emisor Rfc="ABC123456AB1" Nombre="JOHN DOE"/> <cfdi:Conceptos> <cfdi:Concepto ValorUnitario="93.80"> </cfdi:Concepto> </cfdi:Conceptos> <cfdi:Complemento> <tfd:Digital Version="1.1" Sello="BXTJPwDh+" NoCertificado="0000100" FechaTimbrado="2019-07-18" UID="C58C" xmlns:tfd="http://www.stackoverflow.com"/> </cfdi:Complemento> </cfdi:Comprobante>'; $cleanXml = str_ireplace(['cfdi:', 'tfd:'], '', $xml); // strip namespace prefixes from xml $xml = simplexml_load_string($cleanXml); $arr = json_decode(json_encode($xml), true); // xml to associative array $total = (float)$arr['@attributes']['Total']; $rfc = (string)$arr['Emisor']['@attributes']['Rfc']; $uid = (string)$arr['Complemento']['Digital']['@attributes']['UID']; echo 'total : ' . $total; echo PHP_EOL; echo 'rfc : ' . $rfc; echo PHP_EOL; echo 'UID : ' . $uid; echo PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
total : 45264.13 rfc : ABC123456AB1 UID : C58C

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
29.56 ms | 405 KiB | 5 Q