No More Class _

<?php

class _ {}

function _($_) { echo $_; }

const _ = 'hello PHP';

_    (_:_)     ;

?>

Naming a class _ has been deprecated in PHP 8.4.

Luckily, that name is still available for functions and constants, which gives this beauty.

There is already a PHP extension function called _, which is an alias of gettext(), from the gettext extension. If you try this at home, avoid loading that extension, disable the _() with disable_function, or call it __().

See Also

PHP Error Messages

PHP Features

Last updated: 14 July 2026