Is it possible to alias a class method as a global function?
I have a class that acts as a wrapper around the gettext functions in PHP. I have a function called _t() that deals with translations.
I would like to be able to call it as _t() from anywhere in my code without having to do it via an instantiated object ($translate::_t()) as that seems quite unwieldy.
I thought about using namespaces to give the object an alias:
Use translations\TranslationClass as T
Although this is a better improvement: T::_t(). it is still not as need as just having to do _t().
Are there anyways to alias T::_t() as just _t() across the whole application?
You can either create a wrapper function or use create_function().
Or you can create a function on the fly: