3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare (strict_types=1); final class Immutable { private $views; public function __construct(int $views) { $this->views = $views; } public function increaseViews(int $views): self { $this->views += $views; return new self($this->views); } public function getViews(): int { return $this->views; } } $imm = new Immutable(1); $imm->increaseViews(3); $imm->increaseViews(3); $imm->increaseViews(3); $imm->increaseViews(3); $imm->increaseViews(3); $imm->increaseViews(3); $imm->increaseViews(3); $imm->increaseViews(3); v print $imm->getViews();
Output for 7.0.30 - 7.3.0alpha1
Parse error: syntax error, unexpected 'print' (T_PRINT) in /in/Z926t on line 36
Process exited with code 255.
Output for hhvm-3.18.5, hhvm-3.22.0
Fatal error: Uncaught Error: syntax error, unexpected T_PRINT in /in/Z926t:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.21.3
Fatal error: Uncaught Error: syntax error, unexpected T_PRINT in /in/Z926t:36 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.30
Warning: Unsupported declare 'strict_types' in /in/Z926t on line 3 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/Z926t on line 14
Process exited with code 255.