Can a class method be used as a global function?
I have a class that acts as a wrapper around gettext functions in PHP. I have a function called _t() that deals with translations.
I would like to be able to call it _t() from anywhere in my code without having to do it through an instance of the object ( $translate::_t() ), as this seems rather cumbersome.
I was thinking about using namespaces to give the object an alias:
Use translations\TranslationClass as T
Although this is the best improvement: T::_t() . this is still not as necessary as just doing _t() .
Are there anyways for the alias T::_t() as soon as _t() for the entire application?
source share