3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Monad boxing integer side effects * * @package default * @subpackage default * @author Federico Marani **/ class IntegerBox { /** * undocumented function * * @return void **/ public function __construct($value) { $this->value = $value; $this->isNaN = false; $this->infinite = false; } /** * undocumented function * * @return void **/ public static function identity($unboxedInt) { return new IntegerBox($unboxedInt); } /** * undocumented function * * @return void **/ public static function bind($boxedInt, $function) { $newBox = @$function($boxedInt); if ($newBox->value == null) $newBox->infinite = true; return $newBox; } /** * undocumented function * * @return void **/ public function __toString() { if ($this->isNaN) return "NaN"; if ($this->infinite) return "Infinite"; return strval($this->value); } } // END class IntegerBox $plusOne = function($x) { return IntegerBox::identity($x->value + 1); }; $one = IntegerBox::identity(1); $two = IntegerBox::bind($one, $plusOne); print "$two\n"; $divideByZero = function($x) { return IntegerBox::identity(bcdiv($x->value, 0)); }; $newVal = IntegerBox::bind($one, $divideByZero); print "$newVal\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.3.60.0110.00416.88
8.3.50.0190.00316.38
8.3.40.0140.00718.92
8.3.30.0100.00718.67
8.3.20.0080.00018.71
8.3.10.0030.00520.65
8.3.00.0030.00619.50
8.2.180.0070.00716.63
8.2.170.0170.00022.96
8.2.160.0070.00721.05
8.2.150.0000.00824.18
8.2.140.0100.00324.66
8.2.130.0070.00026.16
8.2.120.0070.00019.36
8.2.110.0090.00021.08
8.2.100.0050.00517.91
8.2.90.0070.00321.07
8.2.80.0030.00619.46
8.2.70.0000.00817.75
8.2.60.0030.00518.05
8.2.50.0050.00318.07
8.2.40.0040.00418.15
8.2.30.0060.00318.10
8.2.20.0000.00817.69
8.2.10.0020.00517.81
8.2.00.0050.00317.64
8.1.280.0100.00725.92
8.1.270.0000.01024.66
8.1.260.0080.00026.35
8.1.250.0120.00628.09
8.1.240.0040.00423.97
8.1.230.0040.00720.86
8.1.220.0000.00817.79
8.1.210.0000.00818.88
8.1.200.0000.01017.36
8.1.190.0000.00817.63
8.1.180.0040.00418.10
8.1.170.0070.00018.77
8.1.160.0040.00418.83
8.1.150.0070.00018.67
8.1.140.0080.00017.52
8.1.130.0040.00217.86
8.1.120.0040.00317.38
8.1.110.0040.00417.48
8.1.100.0000.00817.33
8.1.90.0070.00317.50
8.1.80.0050.00317.49
8.1.70.0030.00317.36
8.1.60.0040.00417.63
8.1.50.0030.00517.49
8.1.40.0050.00317.54
8.1.30.0080.00017.66
8.1.20.0060.00317.65
8.1.10.0000.00817.61
8.1.00.0040.00417.53
8.0.300.0040.00419.98
8.0.290.0070.00016.63
8.0.280.0030.00318.51
8.0.270.0000.00717.28
8.0.260.0000.00716.87
8.0.250.0040.00417.04
8.0.240.0000.00817.03
8.0.230.0000.00716.91
8.0.220.0000.00716.89
8.0.210.0000.00717.02
8.0.200.0000.00717.01
8.0.190.0040.00417.07
8.0.180.0040.00417.02
8.0.170.0090.00016.99
8.0.160.0040.00416.98
8.0.150.0080.00017.00
8.0.140.0060.00316.95
8.0.130.0050.00013.37
8.0.120.0040.00416.91
8.0.110.0000.00716.93
8.0.100.0000.00716.89
8.0.90.0040.00417.10
8.0.80.0120.00316.97
8.0.70.0040.00417.08
8.0.60.0040.00416.97
8.0.50.0000.00716.79
8.0.30.0120.00717.11
8.0.20.0100.01017.04
8.0.10.0000.00716.89
8.0.00.0090.00816.86
7.4.330.0000.00513.01
7.4.320.0030.00316.44
7.4.300.0070.00016.61
7.4.290.0070.00016.54
7.4.280.0030.00516.44
7.4.270.0070.00016.53
7.4.260.0000.00513.42
7.4.250.0030.00616.51
7.4.240.0050.00316.53
7.4.230.0030.00316.65
7.4.220.0070.01316.57
7.4.210.0070.01016.57
7.4.200.0000.00716.44
7.4.190.0070.00016.59
7.4.160.0100.01016.55
7.4.150.0100.00716.72
7.4.140.0140.00916.42
7.4.130.0070.01016.62
7.4.120.0110.00616.65
7.4.110.0110.00616.43
7.4.100.0120.00616.37
7.4.90.0100.01016.55
7.4.80.0100.00616.48
7.4.70.0130.00316.29
7.4.60.0120.00916.66
7.4.50.0060.00316.41
7.4.40.0090.00316.41
7.4.30.0040.01216.39
7.4.10.0100.00714.77
7.4.00.0080.01014.99
7.3.330.0040.00413.25
7.3.320.0000.00613.41
7.3.310.0040.00416.48
7.3.300.0030.00316.43
7.3.290.0090.01016.44
7.3.280.0100.00816.36
7.3.270.0130.00616.39
7.3.260.0150.00216.42
7.3.250.0110.00716.57
7.3.240.0080.00816.35
7.3.230.0100.00616.44
7.3.210.0040.01316.62
7.3.200.0080.01419.39
7.3.190.0070.01316.53
7.3.180.0030.01216.49
7.3.170.0060.01016.55
7.3.160.0030.01216.48
7.3.130.0060.00915.07
7.3.120.0100.00715.07
7.3.110.0140.00714.86
7.3.100.0110.00415.13
7.3.90.0100.00714.87
7.3.80.0080.00015.01
7.3.70.0030.01014.79
7.3.60.0030.01014.87
7.3.50.0080.00814.62
7.3.40.0110.00614.82
7.3.30.0100.00314.70
7.3.20.0040.00816.77
7.3.10.0030.01016.65
7.3.00.0080.00516.68
7.2.330.0060.01216.48
7.2.320.0170.00316.52
7.2.310.0060.01616.82
7.2.300.0090.00916.71
7.2.290.0090.00916.76
7.2.260.0090.00915.05
7.2.250.0030.01415.14
7.2.240.0070.00714.92
7.2.230.0030.00714.97
7.2.220.0030.01215.29
7.2.210.0040.00815.27
7.2.200.0070.00714.93
7.2.190.0090.00314.98
7.2.180.0070.00715.00
7.2.170.0000.01515.20
7.2.160.0040.01114.83
7.2.150.0100.00316.99
7.2.140.0060.00916.84
7.2.130.0040.00616.99
7.2.120.0090.00616.94
7.2.110.0000.01316.85
7.2.100.0030.01016.95
7.2.90.0100.00517.07
7.2.80.0050.00817.02
7.2.70.0090.00516.88
7.2.60.0020.01016.80
7.2.50.0060.00916.86
7.2.40.0030.00816.95
7.2.30.0110.00416.84
7.2.20.0060.00916.86
7.2.10.0030.00716.94
7.2.00.0060.00717.87
7.1.330.0080.00815.86
7.1.320.0070.00715.89
7.1.310.0030.01315.75
7.1.300.0060.00315.81
7.1.290.0100.00315.93
7.1.280.0070.00715.79
7.1.270.0000.01315.61
7.1.260.0100.00615.55
7.1.250.0020.01015.80
7.1.240.0080.00715.80
7.1.230.0080.00715.75
7.1.220.0080.00815.95
7.1.210.0030.01015.73
7.1.200.0040.00515.66
7.1.190.0080.00715.79
7.1.180.0050.00815.68
7.1.170.0060.00815.76
7.1.160.0040.00915.61
7.1.150.0070.00715.75
7.1.140.0040.00715.81
7.1.130.0050.00815.92
7.1.120.0050.01015.68
7.1.110.0070.00615.83
7.1.100.0080.00516.40
7.1.90.0070.00715.85
7.1.80.0050.00915.75
7.1.70.0060.00716.26
7.1.60.0070.00917.01
7.1.50.0090.00816.26
7.1.40.0090.00415.69
7.1.30.0070.00615.75
7.1.20.0080.00415.76
7.1.10.0090.00615.72
7.1.00.0080.02418.02
7.0.330.0030.00815.38
7.0.320.0060.00515.40
7.0.310.0040.00915.36
7.0.300.0040.01115.36
7.0.290.0020.01115.50
7.0.280.0020.00915.36
7.0.270.0040.00815.26
7.0.260.0050.00615.39
7.0.250.0040.00615.39
7.0.240.0070.00715.38
7.0.230.0110.00215.46
7.0.220.0050.00615.45
7.0.210.0050.00915.27
7.0.200.0060.00515.71
7.0.190.0120.00315.61
7.0.180.0050.00815.41
7.0.170.0070.00515.53
7.0.160.0040.01115.36
7.0.150.0030.00715.37
7.0.140.0050.02717.68
7.0.130.0050.00515.54
7.0.120.0040.02717.49
7.0.110.0060.00515.43
7.0.100.0080.00315.45
7.0.90.0070.00415.24
7.0.80.0030.01115.36
7.0.70.0070.00515.37
7.0.60.0030.02516.84
7.0.50.0030.02316.22
7.0.40.0030.02415.83
7.0.30.0130.02215.56
7.0.20.0100.02115.72
7.0.10.0040.02715.72
7.0.00.0040.01715.68
5.6.400.0040.01114.36
5.6.390.0040.00714.45
5.6.380.0100.00514.41
5.6.370.0060.00614.29
5.6.360.0110.00114.46
5.6.350.0050.00814.25
5.6.340.0080.00514.43
5.6.330.0030.01014.33
5.6.320.0050.00714.45
5.6.310.0030.01014.55
5.6.300.0020.01114.49
5.6.290.0050.00514.47
5.6.280.0020.03116.65
5.6.270.0070.00514.52
5.6.260.0070.00714.38
5.6.250.0050.00914.34
5.6.240.0030.00914.42
5.6.230.0020.00714.23
5.6.220.0030.00614.26
5.6.210.0060.03216.50
5.6.200.0060.03215.70
5.6.190.0050.02716.40
5.6.180.0150.02616.39
5.6.170.0080.03016.33
5.6.160.0050.03216.32
5.6.150.0090.02915.56
5.6.140.0070.03015.57
5.6.130.0050.02515.70
5.6.120.0070.02116.61
5.6.110.0080.03216.51
5.6.100.0090.02916.57
5.6.90.0090.01916.56
5.6.80.0060.03316.36
5.6.70.0050.00914.24
5.6.60.0040.00914.13
5.6.50.0090.00714.54
5.6.40.0070.00714.37
5.6.30.0060.00914.17
5.6.20.0070.00714.42
5.6.10.0030.01314.13
5.6.00.0050.01014.38
5.5.380.0060.00312.64
5.5.370.0060.00712.72
5.5.360.0030.00612.62
5.5.350.0090.03315.14
5.5.340.0030.03214.54
5.5.330.0050.03515.22
5.5.320.0080.02615.21
5.5.310.0120.02415.21
5.5.300.0040.03114.62
5.5.290.0100.02614.47
5.5.280.0050.03015.48
5.5.270.0040.02915.59
5.5.260.0050.03315.39
5.5.250.0050.03315.43
5.5.240.0030.02715.24
5.5.230.0020.01012.68
5.5.220.0060.00712.76
5.5.210.0050.00512.65
5.5.200.0090.00412.62
5.5.190.0050.00512.64
5.5.180.0060.00512.55
5.5.170.0030.00812.52
5.5.160.0080.00312.69
5.5.150.0110.00412.66
5.5.140.0050.00912.62
5.5.130.0030.00912.57
5.5.120.0030.00612.58
5.5.110.0080.00312.68
5.5.100.0080.00312.77
5.5.90.0080.00612.66
5.5.80.0060.00612.63
5.5.70.0070.00512.66
5.5.60.0030.00612.59
5.5.50.0040.00712.55
5.5.40.0070.00412.72
5.5.30.0030.00612.44
5.5.20.0050.00612.65
5.5.10.0050.00412.64
5.5.00.0020.01112.69
5.4.450.0050.02513.74
5.4.440.0050.01713.95
5.4.430.0040.02113.81
5.4.420.0080.02613.95
5.4.410.0100.02413.93
5.4.400.0090.02713.68
5.4.390.0070.01613.72
5.4.380.0080.02413.78
5.4.370.0020.02913.65
5.4.360.0060.02613.58
5.4.350.0030.01913.78
5.4.340.0080.02413.76
5.4.330.0050.00510.91
5.4.320.0060.02413.65
5.4.310.0060.02313.77
5.4.300.0080.02613.68
5.4.290.0070.02513.88
5.4.280.0060.01813.74
5.4.270.0030.03013.64
5.4.260.0040.03013.70
5.4.250.0040.03013.77
5.4.240.0100.02313.82
5.4.230.0080.02413.74
5.4.220.0060.03013.80
5.4.210.0050.02613.60
5.4.200.0050.03213.71
5.4.190.0060.01713.69
5.4.180.0020.02513.71
5.4.170.0060.02713.68
5.4.160.0050.02513.86
5.4.150.0050.02013.73
5.4.140.0030.02612.98
5.4.130.0060.02712.87
5.4.120.0010.02812.73
5.4.110.0060.02113.00
5.4.100.0050.02812.84
5.4.90.0040.02412.94
5.4.80.0050.01613.00
5.4.70.0060.01213.05
5.4.60.0030.01612.77
5.4.50.0040.01512.87
5.4.40.0020.01612.91
5.4.30.0010.01812.87
5.4.20.0040.01412.94
5.4.10.0060.01412.83
5.4.00.0030.02112.69
5.3.290.0080.01612.05
5.3.280.0090.02012.11
5.3.270.0020.02812.03
5.3.260.0040.01812.09
5.3.250.0070.02812.09
5.3.240.0050.02512.04
5.3.230.0050.03012.01
5.3.220.0040.02312.00
5.3.210.0080.02611.97
5.3.200.0050.02711.96
5.3.190.0030.01812.03
5.3.180.0040.01412.06
5.3.170.0010.01811.99
5.3.160.0030.01612.05
5.3.150.0050.01612.09
5.3.140.0040.01812.10
5.3.130.0030.01712.03
5.3.120.0020.01512.08
5.3.110.0010.01712.06
5.3.100.0060.01511.87
5.3.90.0050.01211.90
5.3.80.0030.01611.83
5.3.70.0050.01511.78
5.3.60.0050.01611.88
5.3.50.0060.01111.87
5.3.40.0020.01611.80
5.3.30.0050.01611.70
5.3.20.0040.01311.74
5.3.10.0040.01611.65
5.3.00.0020.01611.68
5.2.170.0020.01811.00
5.2.160.0050.01310.97
5.2.150.0070.01211.05
5.2.140.0040.02011.03
5.2.130.0050.01311.02
5.2.120.0000.01811.03
5.2.110.0030.01410.98
5.2.100.0020.01811.09
5.2.90.0030.01611.00
5.2.80.0000.01811.00
5.2.70.0030.01911.03
5.2.60.0020.01710.96
5.2.50.0000.01810.94
5.2.40.0030.01410.96
5.2.30.0020.01710.97
5.2.20.0010.01810.93
5.2.10.0080.01010.84
5.2.00.0020.01810.78
5.1.60.0040.01110.47
5.1.50.0030.01310.48
5.1.40.0020.01610.42
5.1.30.0050.01310.64
5.1.20.0060.01210.66
5.1.10.0040.01310.50
5.1.00.0020.01510.56
5.0.50.0020.0149.75
5.0.40.0030.0159.67
5.0.30.0060.0279.55
5.0.20.0070.0229.59
5.0.10.0020.0249.54
5.0.00.0030.0239.49
4.4.90.0000.0109.48
4.4.80.0000.0109.48
4.4.70.0020.0099.48
4.4.60.0000.0119.48
4.4.50.0010.0089.48
4.4.40.0020.0139.48
4.4.30.0020.0109.48
4.4.20.0030.0089.48
4.4.10.0000.0119.48
4.4.00.0000.0179.48
4.3.110.0020.0129.48
4.3.100.0040.0149.48
4.3.90.0070.0159.48
4.3.80.0050.0189.48
4.3.70.0040.0189.48
4.3.60.0020.0099.48
4.3.50.0070.0089.48
4.3.40.0020.0159.48
4.3.30.0030.0129.48
4.3.20.0020.0219.48
4.3.10.0000.0119.48
4.3.00.0050.0169.48

preferences:
48.71 ms | 401 KiB | 5 Q