CKTIS / PHP
Numeric types
The integer range depends on the platform.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
PHP_INT_MAX + 1; intdiv(7, 2);The integer range depends on the platform. Arithmetic exceeding PHP_INT_MAX may produce a float, whose finite binary precision cannot distinguish all large consecutive integers. The / operator can return a float. intdiv truncates the integer quotient toward zero, including for negative inputs.
$large=PHP_INT_MAX+1; echo json_encode([get_debug_type($large),7/2,intdiv(-7,2),-7%2]);
["float",3.5,-3,-1]
Examples
<?php
$large=PHP_INT_MAX+1; echo json_encode([get_debug_type($large),7/2,intdiv(-7,2),-7%2]);
Result
["float",3.5,-3,-1]