3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <footer xmlns:t="ddtemplate"> <p> <t:span child="sign-in" class="sign-in" /> <t:span child="copyright" class="footer-copyright" /> </p> </footer> XML; $doc = DOMDocument::loadXML($xml); /* Template Values */ $tv = array(); $f = $doc->createDocumentFragment(); if ($u->isRegistered()) { if (Config::get("ENABLE_USER_PROFILES")) { $userName = '<a href="' . $this->url('/profile') . '">' . $u->getUserName() . '</a>'; } else { $userName = $u->getUserName(); } $f->appendXML(t('Currently logged in as <b>%s</b>.', $userName) . '<a href="' . $this->url('/login', 'logout') . '">' . t('Sign Out') . '</a>'); } else { $f->appendXML('<a href="' . $this->url('/login') . '">' . t('Sign In to Edit this Site') . '</a>'); } $tv['sign-in'] = $f; $tv['copyright'] = $doc->createTextNode('&copy;' . date('Y') . ' ' . SITE); foreach($doc->getElementsByTagNameNS('ddtemplate','*') as $el) { $el->appendChild($tv[$el->getAttribute('child')]); } echo $doc->saveHTML();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Non-static method DOMDocument::loadXML() cannot be called statically in /in/bg2ZG:11 Stack trace: #0 {main} thrown in /in/bg2ZG on line 11
Process exited with code 255.
Output for 7.0.5 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: Non-static method DOMDocument::loadXML() should not be called statically in /in/bg2ZG on line 11 Notice: Undefined variable: u in /in/bg2ZG on line 17 Fatal error: Uncaught Error: Call to a member function isRegistered() on null in /in/bg2ZG:17 Stack trace: #0 {main} thrown in /in/bg2ZG on line 17
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to a member function isRegistered() on null in /in/bg2ZG:17 Stack trace: #0 {main} thrown in /in/bg2ZG on line 17
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Deprecated: Non-static method DOMDocument::loadXML() should not be called statically in /in/bg2ZG on line 11 Notice: Undefined variable: u in /in/bg2ZG on line 17 Fatal error: Uncaught Error: Call to a member function isRegistered() on unknown in /in/bg2ZG:17 Stack trace: #0 {main} thrown in /in/bg2ZG on line 17
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/bg2ZG on line 11 Notice: Undefined variable: u in /in/bg2ZG on line 17 Fatal error: Call to a member function isRegistered() on null in /in/bg2ZG on line 17
Process exited with code 255.
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/bg2ZG on line 11 Notice: Undefined variable: u in /in/bg2ZG on line 17 Fatal error: Call to a member function isRegistered() on a non-object in /in/bg2ZG on line 17
Process exited with code 255.
Output for 5.1.2
Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/bg2ZG on line 12 Notice: Undefined variable: u in /in/bg2ZG on line 18 Fatal error: Call to a member function isRegistered() on a non-object in /in/bg2ZG on line 18
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/bg2ZG on line 11 Notice: Undefined variable: u in /in/bg2ZG on line 17 Fatal error: Call to a member function isRegistered() on a non-object in /in/bg2ZG on line 17
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Undefined class name 'domdocument' in /in/bg2ZG on line 11
Process exited with code 255.
Output for 4.4.2
Fatal error: Undefined class name 'domdocument' in /in/bg2ZG on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'domdocument' in /in/bg2ZG on line 11

preferences:
289.79 ms | 401 KiB | 460 Q