PHP รองรับ error control operator คือเครื่องหมาย @ (at sign) เมื่อ @ วางหน้าของ expression ข้อความ error ใดๆ ที่อาจเกิดจาก expression นั้นจะถูกเพิกเฉย
การใช้ @ symbol ใน PHP โค้ดมีดังนี้ −
ตัวอย่าง
<?php
$file = @file ('non_existent_file') or
die ("Failed in opening the file: Error Message = '$err'");
$value = @$cache[$key];
?>ผลลัพธ์
จะผลลัพธ์ดังนี้ −
Failed in opening the file: Error Message = ''PHP Notice: Undefined variable: err in /home/cg/root/6985034/main.php on line 4
ตัวอย่าง
มาดูตัวอย่างอีกอย่าง −
<?php
$val = $test['5']
$val = @$test['5']
?>ผลลัพธ์
จะผลลัพธ์ดังนี้ −
PHP Parse error: syntax error, unexpected '$val' (T_VARIABLE) in /home/cg/root/6985034/main.php on line 5