PHP Infinity Is Reachable¶
<?php
var_dump(is_infinite(log(0)));
// true
var_dump(1 > log(0));
// true
Infinite values are sometimes returned by PHP functions, such as log(0) or exp(PHP_INT_MAX). In these cases, beware and do not compare it directly with an integer as a positive is considered bigger than infinite. It is recommended to use the function is_finite.
See Also¶
PHP Features¶
Last updated: 14 July 2026