根据http://php.net/manual/en/functions.user-defined.php,我应该能够使用下划线(_)作为函数名称:
但是,以下内容将杀死我的程序,而不会引起任何错误:
error_reporting(E_ALL);
echo('start');
function _($x){return ($x)?htmlspecialchars($x):'nbsp;';}
echo('end');
我正在使用PHP版本5.3.18。我不懂什么
最佳答案
已经有一个内置函数_
;它是 gettext
的别名。
您可能会收到一个Fatal error: Cannot redeclare _()
,但根据您对display_errors
的设置,该错误可能不会输出到屏幕上。您还可以查看log_errors
指令。