ceil() Strict Mode¶
ceil() doesn’t accept internal objects that can be converted to integer. This is the case for gmp and bcmath objects, as shown in the example. Since PHP 8.0, only integers and floats are allowed.
PHP code¶
<?php
$a = gmp_init(123456);
echo ceil($a);
?>
Before¶
123456
After¶
PHP Fatal error: Uncaught TypeError: ceil(): Argument #1 ($num) must be of type int|float, GMP given
Fatal error: Uncaught TypeError: ceil(): Argument #1 ($num) must be of type int|float, GMP given
PHP version change¶
This behavior changed in 8.0