warning: division by zero
I am using the following static method for sending mail alerts, but its throwing an error: warning:division by zero
...
Postman::MailAlert($_POST['email'],'Hello '.$_POST['name'].', Thanks for signing up.Your customer id is '.$_POST['city']/'/'.$product_id.'.');
I have solved this issue by putting @, but why is this issue raised, and what am I doing wrong?
Just the problem part:
$_POST['city']/'/'.$product_id.'.');
Need to change like this.
$_POST['city'] . '/'.$product_id.'.');
Near the end of that line of code:
[...]$_POST['city']/'/'[...]
Add some spaces to make it clear:
[...] $_POST['city'] / '/' [...]
You're trying to divide $_POST['city']
by '/'
. If non-numeric strings ( '/'
) are interpreted by PHP as having a numeric value of 0, then you're dividing by 0.
Maybe you meant to concatenate instead of divide?
$_POST['city']/'/'
应该变成$_POST['city'].'/'
, $_POST['city'].'/'
下一篇: 警告:除以零