Is it necessary to use strict comparison (===) in PHP conditionals when checking form inputs?

When checking form inputs in PHP conditionals, it is not always necessary to use strict comparison (===). Using strict comparison ensures that both the value and data type are the same, which can be useful in certain cases to avoid unexpected type coercion. However, in many cases, loose comparison (==) can be sufficient, especially when dealing with form inputs where the data type may not always be consistent.

// Example of using loose comparison in PHP conditional for checking form input
$userInput = $_POST['username'];

if ($userInput == 'admin') {
    echo 'Welcome admin!';
} else {
    echo 'Invalid username';
}