Home  >  Article  >  Backend Development  >  My first PHP program_PHP tutorial

My first PHP program_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:45:19918browse



<br> <?php<br /> echo "My Calculator";<br /> ?><br>



My Calculator


num1:

num2:

Calculation method:



$num1 = $_POST['num1'];
$num2 =$_REQUEST['num2'];
$run = $_REQUEST['run'];
switch($run)
{
case '+':print("The sum of the two numbers is: ".($num1+$num2));break;
case '-':print("The difference between the two numbers is: ".($num1-$num2));break;
case '*':print("The product of two numbers is: ".($num1*$num2));break;
case '/':print("The sum of the two numbers is: ".($num1/$num2));break;
}
?>



This article comes from the blog "ITeamsky-Yang Bo's Technology Space"

http://www.bkjia.com/PHPjc/478672.html

truehttp: //www.bkjia.com/PHPjc/478672.htmlTechArticlehtml head title ?php echo my calculator; ? /title /head script type=text/javascript function Onclick () { var num1 = document.getElementById(num1).value; var num2 = document.getEl...
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