[Tiny Tip] Use is_numeric() instead of is_int() when you have a number as a string




If you have a number as a string is_int() won’t work. This will most probably clear your doubt.


<?php
var_dump(is_int(12));
var_dump(is_int("12"));
?>

Output:


bool(true)
bool(false)




<?php
var_dump(is_numeric(56));
var_dump(is_numeric("56"));
?>

Output:


bool(true)
bool(true)


Happy Programming,







Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay