Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

Error Messages

Extension

Analyzer

© 2023-2026, Damien Seguy - Exakat