3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace DOMWorks; use \DOMNode, \DOMDocument; class Node extends DOMNode { public function foo() { echo "Yay for foo!"; } } class Element extends DOMElement { public function bar() { echo "Yay for bar!"; } } class Document extends DOMDocument { public function __construct($version = null, $encoding = null) { parent::__construct($version, $encoding); $this->registerNodeClass('\DOMElement', __NAMESPACE__ . '\Element'); $this->registerNodeClass('\DOMNode', __NAMESPACE__ . '\Node'); echo __NAMESPACE__ } // methods... } $doc = new Document; $doc->foo();
Output for 5.3.0 - 5.4.16
Parse error: syntax error, unexpected '}', expecting ',' or ';' in /in/WTFqC on line 32
Process exited with code 255.