What is@in php for?

Asked

Viewed 62 times

0

Hello, I’m a beginner in php and I came up with a question that I could not find a plausible answer on google; what is the "@" in php for? is seeing a tutorial on how the MYSQLI in php and video the boy used the code @mysqli_connect. someone can explain me?

  • http://php.net/manual/en/language.operators.errorcontrol.php

1 answer

2

It suppresses error messages.
See in Operators of error control

Example:

<?php
/* Erro de arquivo intencional */
$my_file = @file ('arquivo_nao_existente') or
    die ("Falha abrindo arquivo: '$php_errormsg'");

// Isto funciona para qualquer expressão, não apenas para funções:
$value = @$cache[$key];
// você não receberá nenhum aviso se a chave $key não existir.

?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.