I have a PHP application with tons of lines and gettext calls such as _("some text")
Is there a way to overload this _("") operator to perform some runtime checks? Something like:
function _($argument) {
$result = _($argument); // this would be the non-overloaded _()
/* perform some checks or logging */
return $result;
}
Namespacing perhaps:
namespace myUnderscore;
function _($argument) {
$result = \_($argument); // this would be the non-overloaded _()
/* perform some checks or logging */
return strrev($result);
}
$argument = 'gazebo';
echo _($argument) . PHP_EOL; // call overloaded _()
echo \_($argument) . PHP_EOL; // call non-overloaded _()