First time here? Check out the FAQ!
x

What is an error control operator used in the PHP language?

0 votes
asked by (120 points) about PHP
retagged by

What is an error control operator used in the PHP language?

1 Answer

0 votes
answered by (309k points)

An error control operator stores and logs all the errors in an error log making it easier for you to track down the output error the script may give.

The standard PHP code for an error control operator is:

<?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.

?>

-- Source code © PHP.NET

This code needs to be implemented with additional variables so that it tracks and displays the errors as they happen. For more information you can check the official PHP manual available on the homepage of the developer.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...