3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Node { protected $_type; protected $_props; protected $_children; public function __construct($type, array $props = null) { $this->_type = $type; $this->_props = array(); $this->_children = array(); if (null !== $props) { $this->setProps($props); } } public function getType() { return $this->_type; } public function addChild(Euhit_Markup_Latex_Parser_Node $node) { $this->_children[] = $node; return $this; } public function getChildren() { return $this->_children; } public function setProps(array $props) { foreach ($props as $key => $value) { $this->setProp($key, $value); } return $this; } public function setProp($key, $value) { $this->_props[$key] = $value; return $this; } public function &getProp($key) { return isset($this->_props[$key]) ? $this->_props[$key] : null; } public function __set($key, $value) { $this->setProp($key, $value); } public function &__get($key) { return $this->getProp($key); } } $node = new Node; $dupa = &$node->dupa; $dupa .= 'DUUPA!!!'; echo $node->dupa;
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Node::__construct(), 0 passed in /in/462g4 on line 68 and at least 1 expected in /in/462g4:10 Stack trace: #0 /in/462g4(68): Node->__construct() #1 {main} thrown in /in/462g4 on line 10
Process exited with code 255.
Output for 5.1.0 - 5.2.0, 7.0.0 - 7.0.14
Warning: Missing argument 1 for Node::__construct(), called in /in/462g4 on line 68 and defined in /in/462g4 on line 10 Notice: Undefined variable: type in /in/462g4 on line 12 Notice: Only variable references should be returned by reference in /in/462g4 on line 53 Notice: Only variable references should be returned by reference in /in/462g4 on line 53
Output for hhvm-3.10.0 - 3.12.0
Warning: __construct() expects at least 1 parameter, 0 given in /in/462g4 on line 10 Notice: Undefined variable: type in /in/462g4 on line 12
Output for 5.2.1 - 5.6.28
Warning: Missing argument 1 for Node::__construct(), called in /in/462g4 on line 68 and defined in /in/462g4 on line 10 Notice: Undefined variable: type in /in/462g4 on line 12 Notice: Only variable references should be returned by reference in /in/462g4 on line 53 Notice: Indirect modification of overloaded property Node::$dupa has no effect in /in/462g4 on line 69 Notice: Only variable references should be returned by reference in /in/462g4 on line 53
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/462g4 on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/462g4 on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/462g4 on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/462g4 on line 6
Process exited with code 255.