We can file this one under the “PHP functions I never knew existed and probably will never use” category. Seems that as of PHP 4.2.0 and beyond there was the inclusion of an is_finite() and an is_infinite() function. The names are pretty self explanatory and I’m sure there are some smart kids out there that would use these (although I’d expect them to be working in a different language ;)

The usage is pretty simple, pass the function a value and it will return either boolean true or false:

$value = log(0); // This is infinite

var_dump(
    is_infinite($value),
    is_finite($value);
);

Comment below if you’ve used this function before in the real world, dying to hear about it!