Double Underscore in PHP? Double Underscore in PHP? php php

Double Underscore in PHP?


Looks like you're using Wordpress - wp-includes/l10n.php defines __ as a function that translates a string (similar to gettext and its alias, _ but with an optional parameter for explicitly specifying a domain).


Strictly speaking, it means nothing in PHP as it is not a pre-defined function. However, in many frameworks, like CakePHP, and other libraries the double underscore is a function used for translating strings based on the user's language/locale preference.


As mentioned it is generally used for translating text between languages but really it is used in the same context as any function call.

testfunction();

is no different then

__();