What are the differences between the logical OR operator (||) and the OR operator in PHP, and how do they impact assignment operations?

The logical OR operator (||) in PHP is used for boolean operations, while the OR operator is a bitwise operator used for comparing integers. When using the OR operator in assignment operations, it can lead to unexpected behavior as it performs bitwise operations instead of logical operations. To ensure the correct behavior, always use the logical OR operator (||) for boolean operations in PHP.

// Incorrect usage of the OR operator in assignment
$var = true | false; // bitwise OR operation

// Correct usage of the logical OR operator in assignment
$var = true || false; // logical OR operation