What are some common pitfalls when working with boolean values in PHP?

One common pitfall when working with boolean values in PHP is accidentally using the assignment operator `=` instead of the comparison operator `==` or `===`. This can lead to unintended behavior or logical errors in your code. To avoid this, always double-check your comparison statements to ensure you are using the correct operator.

// Incorrect usage of assignment operator
$flag = true;

if ($flag = true) {
    echo "Flag is true";
} else {
    echo "Flag is false";
}

// Correct usage of comparison operator
$flag = true;

if ($flag == true) {
    echo "Flag is true";
} else {
    echo "Flag is false";
}