3v4l.org

run code in 500+ PHP versions simultaneously
<?php $v = (string) PHP_INT_MAX; var_dump($v); var_dump((int) ($v . '.0')); $v = (string) (PHP_INT_MAX - 1); var_dump($v); var_dump((int) ($v . '.0'));
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.2 - 8.5.11
string(19) "9223372036854775807" int(9223372036854775807) string(19) "9223372036854775806" int(9223372036854775807)
Output for 8.5.0 - 8.5.1
string(19) "9223372036854775807" Warning: The float-string "9223372036854775807.0" is not representable as an int, cast occurred in /in/rtTtl on line 5 int(9223372036854775807) string(19) "9223372036854775806" Warning: The float-string "9223372036854775806.0" is not representable as an int, cast occurred in /in/rtTtl on line 9 int(9223372036854775807)

preferences:
35.35 ms | 1144 KiB | 11 Q