3v4l.org

run code in 200+ php & hhvm versions
<?php declare(strict_types=1); final class Stacker { private array $stack = []; public function push($obj): Stacker { $this->stack[] = $obj; return $this; } public function shift() { return array_shift($this->stack); } public function pop() { return array_pop($this->stack); } } $stack = new Stacker(); $stack->push(1);
Output for 7.4.0alpha1 - 7.4.0beta2
Output for 7.1.25 - 7.3.8
Parse error: syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST) in /in/h2TW1 on line 3
Process exited with code 255.