In PHP, what are some common mistakes to avoid when using numeric literals in comparisons within if statements?

When using numeric literals in comparisons within if statements in PHP, it is important to avoid comparing using the equality operator (==) as it may lead to unexpected results due to type juggling. To ensure strict type checking, it is recommended to use the identical operator (===) instead. This will compare both the value and the type of the operands, preventing any unintended conversions.

// Incorrect way using equality operator
if ($num == 5) {
    echo "Number is 5";
}

// Correct way using identical operator
if ($num === 5) {
    echo "Number is 5";
}