mercredi 16 janvier 2019

What is the difference between filter_var(FILTER_VALIDATE_INT) and is_int? [duplicate]

This question already has an answer here:

I've used either function for checking and validating integers in many applications like so

$foo = $bar;

if (filter_var($foo,FILTER_VALIDATE_INT)) {
// do something
}

AND

if (is_int($foo)) {
 // do something
}

Both works perfectly but I want to know the difference between the two in terms of speed and results because PHP being a tricky language has differences between functions that seem to do the same thing e.g mt_rand and rand




Aucun commentaire:

Enregistrer un commentaire