Is_numeric()
as well as is_int()
returns false if the value is 0. What can i do instead to verify that a specific value is numbers only in PHP?
Are we heading straight for the Regular Expressions camp, or are there some nice, handy feature for this out there already?
Thanks!
It is returning true for me in both cases:
var_dump(is_numeric(0));
var_dump(is_int(0));
Result:
bool(true)
bool(true)
Zero, as an integer is empty. So ensure that there is no check for empty before you check for Is_numeric() or is_int()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With