Is someone can explain me this..:
$bob = $_POST['foo'] ;
is_int($bob) FAIL but is_numeric($bob) is OK .
is_int($bob)
is_numeric($bob)
So i know i cannot use is_int directly on $_POST but here i transfert the post value in another variable before..
Whats wrong please ?!
$_POST values are strings, no matter whether they contain a numeric value or not. Just transferring them to a different variable doesn't change that.
$_POST
You'd have to typecast the variable:
$bob = (int) $_POST['foo'];
but note that non-integer values are cast to 0 in this case.
0
$_POST
values are strings, no matter whether they contain a numeric value or not. Just transferring them to a different variable doesn't change that.You'd have to typecast the variable:
but note that non-integer values are cast to
0
in this case.