3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface NodeInterface { public function eval() : int } class Node implements NodeInterface { public int $value; public string $sign; public Node $rightChild; public Node $leftChild; public function eval() { if ($rightChild != null) { return $this->value; } switch ($this->sign) { case "+": return $this->leftChild->value + $this->rightChild->value; //... } } } $root = new Node(); $root->value = 10; echo $root->eval();
Output for 8.0.0 - 8.0.13
Parse error: syntax error, unexpected token "}", expecting ";" or "{" in /in/WjWBB on line 6
Process exited with code 255.
Output for 7.3.13 - 7.3.33, 7.4.0 - 7.4.26
Parse error: syntax error, unexpected '}', expecting ';' or '{' in /in/WjWBB on line 6
Process exited with code 255.

preferences:
204.67 ms | 1399 KiB | 67 Q