Questions about getting variables in php

Source: Internet
Author: User
PHPcode @ $ judge =$ _ GET [& quot; speed & quot;]; if (@ $ keyboard =$ _ GET [& quot; keyboard & quot;]) {$ keyboardfinal = 100;} if (@ $ judge = 1) {if ($ keyboard about getting variables in php
PHP code
  @$judge=$_GET["speed"];if(@$keyboard=$_GET["keyboard"]){$keyboardfinal=100;}if(@$judge==1){if($keyboard<40 && $keyboard>0){@$keyboardfinal=50;    }}if(@$judge==2){if(@$keyboard<50&& $keyboard>0){$keyboardfinal=50;    }}if(@$judge==3 && (@$keyboard<170 && @$keyboard>0)){$keyboardfinal=50;    }

Code above ~ In the second, third, and fourth if statements, $ keyboardfinal = 50 cannot be made even if the conditions are true. why?


------ Solution --------------------
@ $ Judge = $ _ GET ["speed"];
Why is the special effect of adding @ in front of the variable?
------ Solution --------------------
I don't understand why I need to add so many error controllers. If no error is reported, how can I modify the code?
Modify the landlord's code:
PHP code
$ Judge = 1; $ keyboard = 35; $ keyboardfinal = null; switch ($ judge) {case 1: if ($ keyboard <40 & $ keyboard> 0) $ keyboardfinal = 50; break; case 2: if ($ keyboard <50 & $ keyboard> 0) $ keyboardfinal = 50; break; case 3 & ($ keyboard <170 & $ keyboard> 0): $ keyboardfinal = 50; break;} echo "keyboardfinal --> ". $ keyboardfinal; #50
------ Solution --------------------
Discussion
PHP code
@ $ Judge = $ _ GET ["speed"];
If (@ $ keyboard = $ _ GET ["keyboard"]) {
$ Keyboardfinal = 100;
}
If (@ $ judge = 1 ){
If ($ keyboard <40 & $ keyboard> 0 ){
@ $ Keyboardfinal = 50;
}
}
If (@ $ judge = 2 ){
If (@ $ keyb ......

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.