I am writing a PHP mail function and some examples have @mail(…)
and others have just mail(…)
.
What is the difference and which one is best to use?
Cheers
I am writing a PHP mail function and some examples have @mail(…)
and others have just mail(…)
.
What is the difference and which one is best to use?
Cheers
@
supresses all warnings/errors, which mail()
function may throw.
It is not good practice to use "@", because you never know if something doesn't work and also it hits the performance of you PHP application too!
@mail
means you are suppressing any errors that might occur while trying to send the email, see this SO question for more information: http://stackoverflow.com/questions/136899/ddg#138110
Error suppression is resource-consuming operation. It is recommended to call functions without @ and use exceptions/error handling