3v4l.org

run code in 500+ PHP versions simultaneously
<?php function absint( $maybeint ) { return abs( (int) $maybeint ); } $values = array( PHP_INT_MIN, PHP_INT_MIN * 2, PHP_INT_MAX, PHP_INT_MAX * 2, ); foreach ( $values as $value ) { echo "absint( $value ) === "; var_dump( absint( $value ) ); echo "\n\n"; }
Output for 8.5.0 - 8.5.9
absint( -9223372036854775808 ) === float(9.223372036854776E+18) absint( -1.844674407371E+19 ) === Warning: The float -1.8446744073709552E+19 is not representable as an int, cast occurred in /in/ZsvNQ on line 4 int(0) absint( 9223372036854775807 ) === int(9223372036854775807) absint( 1.844674407371E+19 ) === Warning: The float 1.8446744073709552E+19 is not representable as an int, cast occurred in /in/ZsvNQ on line 4 int(0)
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.33, 8.3.0 - 8.3.33, 8.4.1 - 8.4.24
absint( -9223372036854775808 ) === float(9.223372036854776E+18) absint( -1.844674407371E+19 ) === int(0) absint( 9223372036854775807 ) === int(9223372036854775807) absint( 1.844674407371E+19 ) === int(0)
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
absint( -9223372036854775808 ) === float(9.2233720368548E+18) absint( -1.844674407371E+19 ) === int(0) absint( 9223372036854775807 ) === int(9223372036854775807) absint( 1.844674407371E+19 ) === int(0)
Output for 4.4.0 - 4.4.9, 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Notice: Use of undefined constant PHP_INT_MIN - assumed 'PHP_INT_MIN' in /in/ZsvNQ on line 8 Notice: Use of undefined constant PHP_INT_MIN - assumed 'PHP_INT_MIN' in /in/ZsvNQ on line 9 absint( PHP_INT_MIN ) === int(0) absint( 0 ) === int(0) absint( 9223372036854775807 ) === int(9223372036854775807) absint( 1.844674407371E+19 ) === int(0)
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.4
Notice: Use of undefined constant PHP_INT_MIN - assumed 'PHP_INT_MIN' in /in/ZsvNQ on line 8 Notice: Use of undefined constant PHP_INT_MIN - assumed 'PHP_INT_MIN' in /in/ZsvNQ on line 9 Notice: Use of undefined constant PHP_INT_MAX - assumed 'PHP_INT_MAX' in /in/ZsvNQ on line 10 Notice: Use of undefined constant PHP_INT_MAX - assumed 'PHP_INT_MAX' in /in/ZsvNQ on line 11 absint( PHP_INT_MIN ) === int(0) absint( 0 ) === int(0) absint( PHP_INT_MAX ) === int(0) absint( 0 ) === int(0)

preferences:
70.89 ms | 2873 KiB | 4 Q