What is the potential issue with using constant comparison in PHP code?

The potential issue with using constant comparison in PHP code is that it may lead to unexpected behavior due to type coercion. To solve this issue, it is recommended to use strict comparison (===) instead of loose comparison (==) to ensure that both the value and the type of the variables are being compared.

// Incorrect constant comparison
$var1 = "1";
$var2 = 1;

if ($var1 == $var2) {
    echo "Equal";
} else {
    echo "Not equal";
}

// Correct strict comparison
if ($var1 === $var2) {
    echo "Equal";
} else {
    echo "Not equal";
}