What does this function do?
_()
Can you link me to the relevant documentation, as searching for "_" is nigh on impossible?
In PHP, the underscore is generally reserved as an alias of gettext() (for translating strings), so instead it uses a double-underscore. All the functions that make up the library are available as static methods of a class called __ – i.e., a double-underscore. …and so on.
It's just an identifier, it's valid. You can use _ by itself as an identifier. that makes _ a variable of type int .
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.
The __() is just an alias for it. So __("some text") is equivalent to gettext("some text") edit: Actually if it's two underscores than it isn't gettext(). The alias for gettext() is one underscore.
If you open http://www.php.net/_ you get to the documentation of the _() function and see its for localization stuff (gettext).
_()
is an alias of gettext().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With