Relaxed Syntax With Const

<?php

class x {
    const array = [];
    const int   = 2;
}

print_r(x::array);
echo x::int;
echo x::class;

?>

Relaxed syntax is the possibility to use PHP keywords as method or class constant names. This leads to funny expressions, that look like something else.

The only forbidden keyword is class, as it is used to report the name of the current class.

See Also

PHP Features

Last updated: 14 July 2026