John K
John K

Reputation: 353

Why can't I declare a function name "_"?

Code:

function _()
{
    echo 'hello word';
}

Output:

Fatal error: Cannot redeclare _()

I haven't defined this function _ before, then why I am getting this error?

Upvotes: 24

Views: 1527

Answers (2)

phihag
phihag

Reputation: 287755

_ is an alias for gettext, a built-in function. Just as you cannot declare a function gettext, you can't create a function _ since one is already there.

Upvotes: 13

deceze
deceze

Reputation: 522005

_() is an alias for gettext.

Upvotes: 31

Related Questions