I want to check if:
Is it possible to check this with one if
statement?
Checking if ===
would do the trick but a PHP notice is thrown. Do I really have to check if the field is set and then if it is true?
if (isset($var) && ($var === true)) { ... }
Well, you could ignore the notice (aka remove it from display using the error_reporting()
function).
Or you could suppress it with the evil @
character:
if (@$var === true) { ... }
This solution is NOT RECOMMENDED