Home  >  Article  >  Backend Development  >  Detailed explanation of php small functions_PHP tutorial

Detailed explanation of php small functions_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:50:271027browse

$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);
}

?>


Counter













Simple Calculator














Excerpted from Battlefield Diary_LAMP Band of Brothers

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478269.htmlTechArticle?php $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($js...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn