3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface NodeInterface { public function addNode(Node $node); public function isLeaf(); public function isNode(); public function getKey(); public function setKey($key); public function getValue(); public function setValue($value); public function getUid(); public function uid(); public function key(); public function value(); } class ArrayComposition implements NodeInterface { protected $uid; protected $nodes; protected $value; public function __construct($value = null, $key = null) { $this->uid = rand(0, 9) . md5(rand(10, 99) . time() . rand(100, 999)) . rand(1000, 9999); $this->value->key = $key; $this->value->val = $value; } public function addNode(Node $node) { $this->nodes[] = $node; return $this; } public function isLeaf() { return count($this->nodes) == 0; } public function isNode() { return count($this->nodes) > 0; } public function getKey() { return $this->value->key; } public function key() { return $this->value->key; } public function setKey($key = null) { $this->value->key = $key; return $this; } public function getValue() { return $this->value->val; } public function value() { return $this->value->val; } public function setValue($value = null) { $this->value->val = $value; return $this; } public function getUid() { return $this->uid; } public function uid() { return $this->uid; } }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Fatal error: Declaration of ArrayComposition::setKey() must be compatible with that of NodeInterface::setKey() in /in/9Xq4O on line 18
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/9Xq4O on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/9Xq4O on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/9Xq4O on line 3
Process exited with code 255.

preferences:
212.72 ms | 401 KiB | 325 Q