3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum TKind { case TK_PUNCT; case TK_NUM; case TK_EOF; } class A{ public TKind $kind; public function __constructor($kindArg){ $this->kind = $kindArg; } } $a = new A(Tkind::TK_PUNCT); var_dump($a);
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.35, 8.3.0 - 8.3.36, 8.4.1 - 8.4.27, 8.5.0 - 8.5.12
object(A)#1 (0) { ["kind"]=> uninitialized(TKind) }
Output for 8.0.1 - 8.0.20
Parse error: syntax error, unexpected identifier "TKind" in /in/18V1r on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected 'TKind' (T_STRING) in /in/18V1r on line 5
Process exited with code 255.

preferences:
29.69 ms | 1165 KiB | 6 Q