Yes:
$boolean = !$boolean;
if it’s not a boolean value, you can use the ternary construction:
$int = ($some_condition ? 1 : 2); // if $some_condition is true, set 1
// otherwise set 2
Yes:
$boolean = !$boolean;
if it’s not a boolean value, you can use the ternary construction:
$int = ($some_condition ? 1 : 2); // if $some_condition is true, set 1
// otherwise set 2