private Is Relaxed

<?php

// relaxed syntax is not possible with constants
// const PROTECTED = 'instanity';

class x {
    // relaxed syntax is possible with class constants
    private const string public = 'protected';
}

PHP has the relaxed syntax since early 7.0, which allows usage of PHP keywords for methods and class constant names.

private, protected and public were forgotten until PHP 8.2: this is now fixed, and this beauty is now possible.

As usual, use with caution.

See Also

PHP Features

Last updated: 14 July 2026