3v4l.org

run code in 500+ PHP versions simultaneously
<?php use Dom\XMLDocument; $xml = XMLDocument::createFromString(<<<EOXML <?xml version="1.0" encoding="UTF-8"?> <note xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="note-nonamespace1.xsd http://localhost/note-nonamespace2.xsd" xsi:schemaLocation="http://www.happy-helpers1.com note-namespace1.xsd http://www.happy-helpers2.com http://localhost/note-namespace2.xsd"> </note> EOXML ); $documentElement = $xml->documentElement; $attributes = $documentElement->attributes; $schemaLocation = $attributes->getNamedItemNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation'); var_dump(explode(' ', $schemaLocation->textContent ?? ''));
Output for 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35
Fatal error: Uncaught Error: Class "Dom\XMLDocument" not found in /in/jjbDc:5 Stack trace: #0 {main} thrown in /in/jjbDc on line 5
Process exited with code 255.
Output for 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
array(4) { [0]=> string(29) "http://www.happy-helpers1.com" [1]=> string(19) "note-namespace1.xsd" [2]=> string(29) "http://www.happy-helpers2.com" [3]=> string(36) "http://localhost/note-namespace2.xsd" }

preferences:
31.4 ms | 1155 KiB | 9 Q