The __ function in PHP

Recently I bumped into a function I wasn’t familiar with in PHP, It looked like the app I was working in was wrapping just about every constant that they used in the __ function. (Yes, that is two underscores.)

It turns out that this is actually an abbreviation for the gettext function, which is for allowing your application to support multiple languages. I think that this is a very clean way to support multiple languages (though admittedly, I haven’t read it very carefully yet), but I really do think that a better function abriviation could have been chosen. Oh, well, I suppose you learn something new every day.

Leave a Reply

Your email address will not be published. Required fields are marked *