There is the difference, but I don’t know if it exactly applies to the case presented. The difference between using !(condition) and condition === false is that PHP naturally considers some values, different from false, as false. Some of them: zero number, empty array, empty string.
$tests = [0, [], "", false];
foreach ($tests as $condition)
{
if (!$condition)
{
echo "A condição é verdadeira!" . PHP_EOL;
}
}
Running the above test, you will notice that the four tests will pass, as the four values are considered false by PHP and obviously negating it with !, the test becomes true. However, in doing:
$tests = [0, [], "", false];
foreach ($tests as $condition)
{
if ($condition === false)
{
echo "A condição é verdadeira!" . PHP_EOL;
}
}
Only the last test will pass (remembering that the operator === checks whether the parameters are identical, while the == notes the equality of values).
Utilise !(condition) is the same as doing condition == false, but completely different from condition === false.
For the function filter_var this is important because when reading the documentation, you will see:
Valor retornado: Retorna o dado filtrado, ou FALSE se o filtro falhar.
If somehow the filtered value is considered false by PHP, even if it is valid, its condition !(condition) will indicate the value as invalid while condition === false will only indicate as invalid if the filter actually fails.
I tested and there is no difference, the two work well, tested with zero, false and null. As for the future only God knows :)
– user60252