PHP: Check if variable exist but also if has a value equal to something

前端 未结 13 1734
抹茶落季
抹茶落季 2020-12-01 13:46

I have (or not) a variable $_GET[\'myvar\'] coming from my query string and I want to check if this variable exists and also if the value corresponds to somethi

13条回答
  •  萌比男神i
    2020-12-01 14:20

    A solution that I have found from playing around is to do:

    if($x=&$_GET["myvar"] == "something")
    {
        // do stuff with $x
    }
    

提交回复
热议问题