PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
jonnyfortis
Forum Contributor
Posts: 462 Joined: Tue Jan 10, 2012 6:05 am
Post
by jonnyfortis » Mon Jul 14, 2014 7:49 am
I have the following code on a page
Code: Select all
<?php
$send = mail($to,$subject,$message,$headers);
?>
<?php
if(@$send == 1)
{
?>
Notification email sent
<?php
}
?>
and i want to know what the function of the @ symbol is before the $send
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Mon Jul 14, 2014 12:16 pm
Besides, in this case there's absolutely no reason to use it: there's no possible error that can result from trying to use $send.
jonnyfortis
Forum Contributor
Posts: 462 Joined: Tue Jan 10, 2012 6:05 am
Post
by jonnyfortis » Mon Jul 14, 2014 1:33 pm
requinix wrote: Besides, in this case there's absolutely no reason to use it: there's no possible error that can result from trying to use $send.
so your saying
Code: Select all
<?php
$send = mail($to,$subject,$message,$headers);
?>
<?php
if($send == 1)
{
?>
Notification email sent
<?php
}
?>
should be used?
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Mon Jul 14, 2014 1:49 pm
Yes. The most important point is what Celauran said: avoid @. It suppresses warnings and errors that may be very important to you.