3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = new DOMDocument(); $element = $xml->createElement('saml:Assertion'); $xml_saml_assertion = $xml->appendChild($element); $attribute = $xml->createAttribute('id'); $attribute->value = 'IDCard'; $xml_saml_assertion->appendChild($attribute); $attribute = $xml->createAttribute('xmlns:saml'); $attribute->value = 'urn:oasis:names:tc:SAML:2.0:assertion'; $xml_saml_assertion->appendChild($attribute); $attribute = $xml->createAttribute('Version'); $attribute->value = '2.0'; $xml_saml_assertion->appendChild($attribute); var_dump($element->attributes[1]);
Output for 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
object(DOMAttr)#5 (23) { ["specified"]=> bool(true) ["schemaTypeInfo"]=> NULL ["name"]=> string(10) "xmlns:saml" ["value"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["ownerElement"]=> string(22) "(object value omitted)" ["nodeName"]=> string(10) "xmlns:saml" ["nodeValue"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> NULL ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(10) "xmlns:saml" ["baseURI"]=> NULL ["textContent"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" }
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 object(DOMAttr)#5 (23) { ["specified"]=> bool(true) ["schemaTypeInfo"]=> NULL ["name"]=> string(10) "xmlns:saml" ["value"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["ownerElement"]=> string(22) "(object value omitted)" ["nodeName"]=> string(10) "xmlns:saml" ["nodeValue"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> NULL ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(10) "xmlns:saml" ["baseURI"]=> NULL ["textContent"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
object(DOMAttr)#5 (21) { ["specified"]=> bool(true) ["schemaTypeInfo"]=> NULL ["name"]=> string(10) "xmlns:saml" ["value"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["ownerElement"]=> string(22) "(object value omitted)" ["nodeName"]=> string(10) "xmlns:saml" ["nodeValue"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(10) "xmlns:saml" ["baseURI"]=> NULL ["textContent"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" }
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
object(DOMAttr)#5 (21) { ["name"]=> string(10) "xmlns:saml" ["specified"]=> bool(true) ["value"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["ownerElement"]=> string(22) "(object value omitted)" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(10) "xmlns:saml" ["nodeValue"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" ["nodeType"]=> int(2) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> NULL ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(10) "xmlns:saml" ["baseURI"]=> NULL ["textContent"]=> string(37) "urn:oasis:names:tc:SAML:2.0:assertion" }

preferences:
151.95 ms | 404 KiB | 183 Q