How to check if a param exists and equals a certain value?

Hi all,

Really a basic question, I’m creating a shortcode and within it I’d like to check if a certain param exists on the shortcode and if it equals a certain value. What would be the best possible way of doing that? Of course I could use two if statements but it feels bloated somehow. Is there a shorter method?

I should also say that the param is optional so its not always available…

In that case definitely use with because that is what it does, but I think you need to use an if inside it.

OK! I guess two statements then… I was hoping to be able to do something like this:

if(isset($var) && $var == "someValue") {
    //do something
}

Iirc isset assumes the existence of the var, where with does not, and unless you have that var everywhere, the build will fail.