3v4l.org

run code in 500+ PHP versions simultaneously
<?php function absint( $maybeint ) { return abs( (int) $maybeint ); } function new_absint( $maybeint ): int { $maybeint = (int) $maybeint; if ( PHP_INT_MIN === $maybeint ) { // `abs( PHP_INT_MIN )` overflows to a float, as `PHP_INT_MAX` is `-PHP_INT_MIN`. return PHP_INT_MAX; } return abs( $maybeint ); } #$data = '999 stuff'; // same #$data = '999999999999999999222222222288888888888888222222222227777777774444'; // same, warning is gone in newer version of PHP 8.5 ( 8.5.2+ ) #$data = -PHP_INT_MIN; // original: float, new: int -- and the numbers differ by 1 #$data = 'now is the time'; // same ( zero ) #$data = -PHP_INT_MAX; // same #$data = PHP_INT_MAX + 1; // original: float ( 9.223372036854776E+18 ), new: int ( 9223372036854775807 ) -- very different numbers $data = PHP_INT_MIN - 1; // original: float( 9.223372036854776E+18 ), new: int( 9223372036854775807 ) -- very different numbers var_dump( $data ); var_dump( absint( $data ) ); var_dump( new_absint( $data ) );

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.90.0100.00716.71
8.5.80.0350.00616.82
8.5.70.0320.00816.32
8.5.60.0340.00716.62
8.5.50.0340.00616.18
8.5.40.0300.01016.27
8.5.30.0280.01216.45
8.5.20.0300.01016.68
8.5.10.0320.00916.30
8.5.00.0110.00916.61
8.4.240.0320.01019.55
8.4.230.0290.01219.38
8.4.220.0320.01719.29
8.4.210.0320.00719.43
8.4.200.0300.01019.48
8.4.190.0330.01119.25
8.4.180.0300.01619.41
8.4.170.0320.00719.14
8.4.160.0370.00919.03
8.4.150.0290.01119.46
8.4.140.0360.00717.60
8.4.130.0330.00817.52
8.4.120.0360.00617.94
8.4.110.0340.01117.43
8.4.100.0320.01117.29
8.4.90.0330.01017.65
8.4.80.0340.00817.70
8.4.70.0330.01017.59
8.4.60.0390.00517.75
8.4.50.0280.01417.67
8.4.40.0370.00817.64
8.4.30.0340.01017.47
8.4.20.0370.00817.56
8.4.10.0330.00817.55
8.3.330.0370.01018.28
8.3.320.0340.01218.22
8.3.310.0300.00718.41
8.3.300.0310.01018.21
8.3.290.0310.00818.16
8.3.280.0320.00718.29
8.3.270.0330.00816.61
8.3.260.0300.00716.59
8.3.250.0280.01316.57
8.3.240.0370.00316.62
8.3.230.0360.00716.68
8.3.220.0370.00616.38
8.3.210.0360.00616.45
8.3.200.0300.00916.60
8.3.190.0360.00816.41
8.3.180.0310.00916.65
8.3.170.0200.00616.64
8.3.160.0170.00316.68
8.3.150.0240.00416.26
8.3.140.0290.00716.43
8.3.130.0140.00316.66
8.3.120.0180.00316.44
8.3.110.0290.00716.66
8.3.100.0340.00916.55
8.3.90.0340.01116.59
8.3.80.0340.00716.45
8.3.70.0340.00916.53
8.3.60.0310.00916.66
8.3.50.0300.01216.37
8.3.40.0400.00417.81
8.3.30.0260.00917.79
8.3.20.0270.00717.85
8.3.10.0200.01317.89
8.3.00.0190.00717.71
8.2.330.0330.00718.05
8.2.320.0300.01017.99
8.2.310.0290.01018.07

preferences:
54.64 ms | 783 KiB | 5 Q