Home > Article > Backend Development > Detailed explanation of php small functions_PHP tutorial
$dy=$_POST["dy"];
$de=$_POST["de"];
$jsf=$_POST["select"];
$qingkong=$_POST["qingkong"];
$Submit=$_POST["Submit"];
if($jsf=="jia"){
$zhi=$dy+$de;
$zhi="Your calculation result is:$zhi";
}
if($jsf=="jian"){
$zhi=$dy-$de;
$zhi="Your calculation result is:$zhi";
}
if($jsf=="chen"){
$zhi=$dy*$de;
$zhi="Your calculation result is:$zhi";
}
if($jsf=="chu"){
if($de=="0"){
$zhi="The dividend cannot be 0, please re-enter a valid number!";
}else{
$zhi=$dy/$de;
$zhi="Your calculation result is:$zhi";
}
}
if($jsf=="yu"){
if($de=="0"){
$zhi="The remainder cannot be 0";
}else{
$zhi=$dy%$de;
}
}
if($qingkong=="clear"){
unset($dy,$de,$zhi);
}
?>