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!
It's the same function but with error suppression
@mail
means you are suppressing any errors that might occur while trying to send the email, see this SO question for more information: Suppress error with @ operator in PHP
Error suppression is resource-consuming operation. It is recommended to call functions without @ and use exceptions/error handling
© 2022 - 2024 — McMap. All rights reserved.