CKTIS / PHP
PHP_INT_MAX / PHP_INT_MIN
Par PHP_INT_MAX / PHP_INT_MIN označuje največje in najmanjše predznačeno celo število glede na širino int v tej gradnji.
Različica: PHP 8.4; repository runtime, production runtime not attested
Sintaksa
$overflow = PHP_INT_MAX + 1;Par PHP_INT_MAX / PHP_INT_MIN označuje največje in najmanjše predznačeno celo število glede na širino int v tej gradnji. Spodnja meja je -PHP_INT_MAX - 1. Navadno seštevanje ali odštevanje čez mejo da float, ki vseh velikih celih števil ne predstavi natančno.
$above = PHP_INT_MAX + 1;
$below = PHP_INT_MIN - 1;
echo json_encode([
PHP_INT_MIN === -PHP_INT_MAX - 1,
get_debug_type(PHP_INT_MAX), get_debug_type(PHP_INT_MIN),
get_debug_type($above), get_debug_type($below)
]);
[true,"int","int","float","float"]
Primeri
<?php
$above = PHP_INT_MAX + 1;
$below = PHP_INT_MIN - 1;
echo json_encode([
PHP_INT_MIN === -PHP_INT_MAX - 1,
get_debug_type(PHP_INT_MAX), get_debug_type(PHP_INT_MIN),
get_debug_type($above), get_debug_type($below)
]);
Rezultat
[true,"int","int","float","float"]