I have a boolean value that I would like to flip between true and false. The basic implementation of this is:
if ($my_boolean) {
$my_boolean = false;
}
else {
$my_boolean = true;
}
Is there a way to simplify this and reduce the number of lines of code?
You can use this:
$my_boolean = !$my_boolean;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With