3v4l.org

run code in 500+ PHP versions simultaneously
<?php function absint( $maybeint ): int { $abs = abs( (int) $maybeint ); /* * abs() can return a float when $maybeint is larger than PHP_INT_MAX. * When that happens, PHP 8.5+ emits a warning that the vale is not * representable as an int and a float value is returned. In this case, * the value is clamped to PHP_INT_MAX. */ if ( is_float( $abs ) ) { return PHP_INT_MAX; } return $abs; } $maybeints = array( 'zero' => 0, 'negative 1 int' => -1, 'positive 1 int' => 1, 'negative min int' => PHP_INT_MIN, 'negative min int minus 1' => PHP_INT_MIN - 1, 'negative min int times 2' => PHP_INT_MIN * 2, 'positive max int' => PHP_INT_MAX, 'positive max int plus 1' => PHP_INT_MAX + 1, 'positive max int times 2' => PHP_INT_MAX * 2, 'positive max int as string' => (string) PHP_INT_MAX, 'positive max int times 1000 as string' => (string) PHP_INT_MAX . '000', ); foreach ( $maybeints as $case => $maybeint ) { echo "# $case\n\n"; echo 'Input: '; var_dump( $maybeint ); echo 'Outut: '; var_dump( absint( $maybeint ) ); echo "\n"; }

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.0200.00616.89
8.5.80.0310.00716.82
8.5.70.0350.00516.78
8.5.60.0310.00716.73
8.5.50.0270.01016.75
8.5.40.0300.00916.41
8.5.30.0320.00816.66
8.5.20.0320.00716.59
8.5.10.0320.01016.60
8.5.00.0100.01016.82
8.4.240.0320.00919.60
8.4.230.0320.01119.41
8.4.220.0300.01119.49
8.4.210.0250.01119.54
8.4.200.0300.01019.48
8.4.190.0290.00819.73
8.4.180.0290.01119.75
8.4.170.0320.01019.50
8.4.160.0330.00919.62
8.4.150.0310.00919.58
8.4.140.0310.00917.65
8.4.130.0310.00717.83
8.4.120.0330.00717.92
8.4.110.0350.01217.88
8.4.100.0350.00617.92
8.4.90.0330.00517.87
8.4.80.0240.00917.66
8.4.70.0290.00517.76
8.4.60.0360.00617.80
8.4.50.0350.01017.85
8.4.40.0320.01017.80
8.4.30.0380.00917.73
8.4.20.0350.00917.77
8.4.10.0380.00917.63
8.3.330.0420.01018.44
8.3.320.0340.00718.46
8.3.310.0280.00818.38
8.3.300.0330.00818.38
8.3.290.0180.00718.53
8.3.280.0210.00818.54
8.3.270.0240.00516.83
8.3.260.0220.00716.82
8.3.250.0250.00616.85
8.3.240.0240.00816.82
8.3.230.0310.00716.83
8.3.220.0310.00916.75
8.3.210.0340.01216.78
8.3.200.0330.01016.83
8.3.190.0330.00816.81
8.3.180.0330.00816.77
8.3.170.0360.00716.77
8.3.160.0320.00916.59
8.3.150.0310.00816.86
8.3.140.0260.00916.78
8.3.130.0250.00616.94
8.3.120.0240.00816.71
8.3.110.0310.00616.75
8.3.100.0260.00616.59
8.3.90.0310.00816.82
8.3.80.0250.00416.79
8.3.70.0330.00616.62
8.3.60.0320.00516.50
8.3.50.0320.00716.96
8.3.40.0370.00817.96
8.3.30.0270.00517.89
8.3.20.0290.00717.86
8.3.10.0260.00918.16
8.3.00.0250.00718.00
8.2.330.0340.00618.03
8.2.320.0250.00717.96
8.2.310.0220.00718.00

preferences:
43.61 ms | 851 KiB | 5 Q