3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace DOMWorks; use \DOMNode, \DOMDocument; class Node extends DOMNode { // methods... public function foo() { echo "Yay for foo!"; } } class Document extends DOMDocument { public function __construct($version = null, $encoding = null) { $this->registerNodeClass('DOMNode', __NAMESPACE__ . '\Node'); } // methods... } $doc = new Document; $doc->foo();
Output for 7.0.0 - 7.3.1
Warning: DOMDocument::registerNodeClass(): Couldn't fetch DOMWorks\Document in /in/Bjgjm on line 21 Fatal error: Uncaught Error: Call to undefined method DOMWorks\Document::foo() in /in/Bjgjm:28 Stack trace: #0 {main} thrown in /in/Bjgjm on line 28
Process exited with code 255.
Output for hhvm-3.10.1 - 3.11.1, hhvm-3.17.3

Process exited with code 139.
Output for hhvm-3.12.14 - 3.15.4

Process exited with code 137.
Output for 5.3.0 - 5.6.38
Warning: DOMDocument::registerNodeClass(): Couldn't fetch DOMWorks\Document in /in/Bjgjm on line 21 Fatal error: Call to undefined method DOMWorks\Document::foo() in /in/Bjgjm on line 28
Process exited with code 255.