有没有一种方法可以重载php';s_()gettext运算符


Is there a way to overload php's _() gettext operator

我有一个PHP应用程序,它有很多行和gettext调用,比如_("some text")

有没有办法重载这个_(")运算符来执行一些运行时检查?类似于:

function _($argument) {
    $result = _($argument); // this would be the non-overloaded _()
    /* perform some checks or logging */
    return $result;
}

名称间距可能:

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 _()