Search code examples
phpfunction-calls

What is the difference between the function calls “mail()” and “@mail()”?


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


Solution

  • @ 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!