Typed Class Constant

Support for typed class constants was added in PHP 8.3

PHP code

<?php

class x {
    public int A = 1;
}

echo X::A;

?>

Before

Parse error: syntax error, unexpected identifier "A", expecting variable

After

1

PHP version change

This behavior changed in 8.3

See Also