Old rules: first, go to the GIF dynamic graph and check the effect. if it meets your project or is sure you want to know the content, see the following: old rules: first go to the GIF dynamic graph, take a look at the effect. if it meets your project or is sure you want to know the content, let's look at it again:
"; // The Code Commented out below is not wrong, but a different switch method // if ($ _ POST ['ysf '] =" + ") {// echo $ _ POST ['num1'] + $ _ POST ['num2']."
"; //} Elseif ($ _ POST ['ysf '] = "-") {// echo $ _ POST ['num1']-$ _ POST ['num2']."
"; //} Elseif ($ _ POST ['ysf '] = "*") {// echo $ _ POST ['num1'] * $ _ POST ['num2']."
"; //} Elseif ($ _ POST ['ysf '] = "/") {// echo $ _ POST ['num1']/$ _ POST ['num2']."
"; //} Elseif ($ _ POST ['ysf '] =" % ") {// echo $ _ POST ['num1'] % $ _ POST ['num2']."
"; //} // Determine whether the two operators are numbers. if not, no operation is performed if (! Is_numeric ($ _ POST ['num1']) |! Is_numeric ($ _ POST ['num2']) {$ isDo = false; echo "one of the operators is not a number and is not operated.
";}Else {$ isDo = true;} // declare the variable calculation result $ sum =" "; if ($ isDo) {// determine whether two operators are numbers. if they are not numbers, do not switch ($ _ POST ['ysf ']) {case' + ': $ sum = $ _ POST ['num1'] + $ _ POST ['num2']; break; case '-': $ sum = $ _ POST ['num1']-$ _ POST ['num2']; break; case '*': $ sum = $ _ POST ['num1'] * $ _ POST ['num2']; break; case '/': $ sum = $ _ POST ['num1']/$ _ POST ['num2']; break; case '% ': $ sum = $ _ POST ['num1'] % $ _ POST ['num2']; break;} echo $ sum."
";}} Else {echo" user refresh page
"; // Die (" no computing processing
") ;}?>
Simple Calculator
The above is the content for Android programmers to learn PHP development (13)-Simple Calculator-PhpStorm. For more information, please follow the PHP Chinese network (www.php1.cn )!