2 ms·
I'm not sure what you expect to happen there but the following code always produces "Correct!": $user_input = '08'; $user_input = (integer)$user_input;
by wvenable 15y ago
I'm not sure what you expect to happen there but the following code always produces "Correct!":
$user_input = '08';
$user_input = (integer)$user_input;
if ($user_input == 8) echo 'Correct!';
if ($user_input == 0) echo 'Incorrect!';
If you take out the cast, the result is the same. If you change the numbers to '010' and 10 respectively, the result is also "Correct!". There is no weirdness.