@ 演算子については、すでに優れた回答が提供されていますが、ここに、あなたまたは他の誰かにとって役立つ情報がいくつかあります。
- デバッグ目的で を無効にする必要がある場合は、 scream 拡張機能
@ operator
をインストールできます(マニュアルも参照してください)。これは、適切に設計/コーディングされていないある種の古いアプリケーションを維持する場合に非常に役立ちます ^^
- PHP の設定によっては(
track_errors
オプションが有効になっている場合)$php_errormsg
、 を使用して最後のエラー メッセージを取得できる場合があります。
このコードを考えると:
// This file doesn't exist
if (!@fopen('/tmp/non-existant-file.txt', 'r')) {
var_dump($php_errormsg);
}
// My Apache server doesn't have the right to read this file
if (!@fopen('/tmp/vboxdrv-Module.symvers', 'w')) {
var_dump($php_errormsg);
}
あなたはこれを得るでしょう:
string 'fopen(/tmp/non-existant-file.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory' (length=129)
string 'fopen(/tmp/vboxdrv-Module.symvers) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied' (length=122)
だから、本当の、役に立つ、意味のあるエラーメッセージ;-)