據http://php.net/manual/en/functions.user-defined.php,我應該能夠使用下劃線(_)作爲函數名稱:使用下劃線(_)作爲PHP函數名
Function names follow the same rules as other labels in PHP. A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*.
但是,下面的殺死我的程序,而不會造成任何錯誤:
error_reporting(E_ALL);
echo('start');
function _($x){return ($x)?htmlspecialchars($x):'nbsp;';}
echo('end');
我正在使用PHP版本5.3.18。我不明白什麼?
您是否打開了錯誤報告? – eisberg
使用雙下劃線代替__($ x) –
上述代碼適用於我。 (PHP Version 5.3.10) – Jeremy1026