Error Control Operators

Comparison Operators
November 13, 2018
Incrementing/Decrementing Operators
November 13, 2018

Error Control Operators

PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.

<?php
/* Intentional file error */
$my_file = @file ('non_existent_file') or
die ("Failed opening file: error was '$php_errormsg'");
// this works for any expression, not just functions:
$value = @$cache[$key];
// will not issue a notice if the index $key doesn’t exist.?>

NoteThe @-operator works only on expressions. A simple rule of thumb is: if you can take the value of something, you can prepend the @ operator to it. For instance, you can prepend it to variables, function and include calls, constants, and so forth. You cannot prepend it to function or class definitions, or conditional structures such as if and foreach, and so forth.

Sondiva Technologies
Sondiva Technologies
Sondiva Technologies started in 2011 with a vision of providing Quality based Web Hosting and Web Designing Services in Ghaziabad, Delhi NCR. Backed up by full stack developers and designers , with over 500+ Web Projects. They work on opensource Platforms like Wordpress, Magneto, Prestashop, Opencart and Core PHP. Other services are : Responsive Web Designing Domain Registration Services Dedicated & SSD Hosting Virtual Private Servers Google GSuite Mail Servers E-Commerce Shopping Portal Development Web Designing & Application Courses SEO & Digital Marketing

Leave a Reply

Your email address will not be published. Required fields are marked *

Shop Now