Answer the question
In order to leave comments, you need to log in
Who can clearly explain why the code is executed this way?
Can you please tell me why PHP enters the if condition?
$test = floatval(0);
if ($test == 'wrong_promo') {
echo 'По идее мне сюда нельзя заходить, но я зайду посмотрю!';
}else{
echo "Жду...";
}
Answer the question
In order to leave comments, you need to log in
It's all about type conversion. 'wrong_promo' is converted to a float, but since the beginning of this string does not contain a number, it is converted to 0, that is, it becomes equal to $test
strongly-typed comparison to help
if ($test === 'wrong_promo') { ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question