Why younger brother I write this program of $a+ $b and $a-$b can not calculate, other can calculate AH ask big God solve!

Source: Internet
Author: User
Why I write this program of $a+ $b and $a-$b can not calculate, other can calculate Ah, ask the big God solve!!!
$a =$_request["NUM1"];
$b =$_request["num2"];
$fuhao =$_request["Fuhao"];

Class cat{
Public function Jisuan ($a, $b, $fuhao) {

Switch ($fuhao) {
Case "+":
$a + $b;
Echo ' $a + $b = '. $a + $b;
Break
Case "-":
$a-$b;
Echo ' $a-$b = '. $a-$b;
Break
Case "*":
$a * $b;
Echo ' $a * $b = '. $a * $b;
Break
Case "/":
$a/$b;
echo ' $a/$b = '. $a/$b;
Break
}
}
}

$cat 1=new Cat ();
$cat 1->jisuan ($a, $b, $fuhao);

?> function class

Share to:


------Solution--------------------
The amount ... The topic did not see clearly, should be the priority of the question, you put the case "+":
$a + $b;
Echo ' $a + $b = '. ($a + $b);
Break
Case "-":
$a-$b;
Echo ' $a-$b = '. ($a-$b);
Break
Change to Case "+":
$a + $b;
Echo ' $a + $b = '. $a + $b;
Break
Case "-":
$a-$b;
Echo ' $a-$b = '. $a-$b;
Break

Develop the habit of adding brackets
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.