3v4l.org

run code in 300+ PHP versions simultaneously
<?php $int = 5; $bits = []; function int_to_bools($int, $count) { $bools = []; for ($i = 0; $i < $count; $i++) { $bools[$i] = (bool)($int & (2 ** $i)); } return $bools; } function bools_to_int($bools) { $int = 0; foreach (array_values($bools) as $i => $bit) { $int |= ((int)$bit) << $i; } return $int; } $int = 5; $bools = int_to_bools($int, 10); var_dump($bools); $int = bools_to_int($bools); var_dump($int);

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.30.0090.00917.44
8.5.20.0100.00819.99
8.5.10.0070.00919.99
8.5.00.0140.01019.82
8.4.180.0120.00925.85
8.4.170.0100.01023.82
8.4.160.0100.01223.98
8.4.150.0080.00516.89
8.4.140.0130.00817.65
8.4.130.0040.00617.61
8.4.120.0110.00922.10
8.4.110.0090.01018.99
8.4.100.0100.00818.53
8.4.90.0050.00320.29
8.4.80.0040.00418.98
8.4.70.0130.00718.88
8.4.60.0100.01018.73
8.4.50.0120.00820.44
8.4.40.0130.00619.45
8.4.30.0130.00717.60
8.4.20.0060.00917.39
8.4.10.0060.00317.50
8.3.300.0120.00820.79
8.3.290.0110.01020.79
8.3.280.0080.01218.37
8.3.270.0110.00916.57
8.3.260.0100.00716.52
8.3.250.0110.00918.73
8.3.240.0120.00716.58
8.3.230.0100.00916.55
8.3.220.0070.00618.97
8.3.210.0110.00716.57
8.3.200.0060.00216.65
8.3.190.0070.00416.82
8.3.180.0020.00617.15
8.3.170.0090.00620.88
8.3.160.0140.00417.06
8.3.150.0070.01117.36
8.3.140.0000.00716.85
8.3.130.0030.00718.58
8.3.120.0100.00720.73
8.3.110.0060.00320.94
8.3.100.0060.00316.75
8.3.90.0030.00716.50
8.3.80.0030.00617.97
8.3.70.0110.00718.28
8.3.60.0100.00718.56
8.3.50.0050.01322.05
8.3.40.0150.00418.94
8.3.30.0070.00718.53
8.3.20.0080.00019.29
8.3.10.0040.00421.94
8.3.00.0040.00419.08
8.2.300.0110.01119.90
8.2.290.0100.00920.56
8.2.280.0070.01118.34
8.2.270.0180.00017.34
8.2.260.0150.00316.71
8.2.250.0060.00318.46
8.2.240.0110.00719.03
8.2.230.0060.01222.58
8.2.220.0030.00624.06
8.2.210.0100.00726.77
8.2.200.0000.00918.41
8.2.190.0110.00418.37
8.2.180.0070.01416.75
8.2.170.0140.00722.96
8.2.160.0070.00720.52
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0000.00817.93
8.2.120.0040.00426.35
8.2.110.0090.00020.43
8.2.100.0100.00317.91
8.2.90.0040.00419.35
8.2.80.0060.00317.97
8.2.70.0060.00317.50
8.2.60.0000.00818.03
8.2.50.0050.00318.09
8.2.40.0060.00322.26
8.2.30.0040.00419.55
8.2.20.0040.00417.73
8.2.10.0020.00518.18
8.2.00.0060.00318.02
8.1.340.0120.00819.91
8.1.330.0100.00922.00
8.1.320.0100.01015.92
8.1.310.0060.00316.79
8.1.300.0060.00320.31
8.1.290.0060.00330.84
8.1.280.0090.00625.92
8.1.270.0040.00423.87
8.1.260.0000.00828.09
8.1.250.0040.00428.09
8.1.240.0030.00723.90
8.1.230.0080.00420.70
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.11
8.1.190.0000.00817.23
8.1.180.0060.00318.10
8.1.170.0080.00018.65
8.1.160.0070.00020.73
8.1.150.0030.00318.93
8.1.140.0020.00519.47
8.1.130.0000.00717.69
8.1.120.0040.00417.49
8.1.110.0000.00817.53
8.1.100.0040.00417.43
8.1.90.0000.00717.46
8.1.80.0040.00417.52
8.1.70.0070.00017.50
8.1.60.0030.00617.61
8.1.50.0040.00417.50
8.1.40.0030.00917.58
8.1.30.0040.00417.65
8.1.20.0050.00217.55
8.1.10.0080.00017.59
8.1.00.0030.00517.40
8.0.300.0040.00418.77
8.0.290.0050.00216.63
8.0.280.0040.00418.39
8.0.270.0050.00217.30
8.0.260.0000.00717.18
8.0.250.0000.00716.88
8.0.240.0030.00316.87
8.0.230.0030.00316.83
8.0.220.0000.00716.84
8.0.210.0000.00716.88
8.0.200.0000.00716.94
8.0.190.0040.00416.98
8.0.180.0070.00016.77
8.0.170.0070.00016.92
8.0.160.0000.00716.87
8.0.150.0040.00416.93
8.0.140.0000.00716.88
8.0.130.0040.00413.32
8.0.120.0030.00516.78
8.0.110.0000.00716.79
8.0.100.0000.00716.86
8.0.90.0040.00416.96
8.0.80.0000.01516.85
8.0.70.0040.00416.89
8.0.60.0040.00416.73
8.0.50.0040.00416.88
8.0.30.0130.00517.26
8.0.20.0100.01317.40
8.0.10.0020.00516.90
8.0.00.0000.01816.84
7.4.330.0020.00215.08
7.4.320.0070.00016.58
7.4.300.0060.00016.49
7.4.290.0070.00016.41
7.4.280.0000.00716.59
7.4.270.0070.00016.41
7.4.260.0080.00016.51
7.4.250.0070.00016.41
7.4.240.0050.00316.60
7.4.230.0000.00716.68
7.4.220.0110.01016.41
7.4.210.0110.00616.62
7.4.200.0000.00716.36
7.4.160.0100.00716.39
7.4.150.0100.00717.40
7.4.140.0100.01417.86
7.4.130.0110.00916.54
7.4.120.0110.00616.52
7.4.110.0140.00716.41
7.4.100.0070.01116.61
7.4.90.0110.00616.43
7.4.80.0160.00619.39
7.4.70.0030.01416.55
7.4.60.0130.00316.53
7.4.50.0040.01116.37
7.4.40.0140.00616.38
7.4.30.0060.01016.61
7.4.00.0060.00615.05
7.3.330.0090.00013.32
7.3.320.0000.00613.23
7.3.310.0030.00316.37
7.3.300.0000.00916.23
7.3.290.0120.00516.39
7.3.280.0090.00816.36
7.3.270.0090.01017.40
7.3.260.0100.00816.51
7.3.250.0070.01416.49
7.3.240.0070.01016.39
7.3.230.0150.00716.43
7.3.210.0110.00616.61
7.3.200.0110.00416.49
7.3.190.0140.00416.28
7.3.180.0090.00916.46
7.3.170.0030.01316.61
7.3.160.0080.01016.50
7.3.10.0150.00416.38
7.3.00.0070.00716.44
7.2.330.0130.00716.70
7.2.320.0170.00316.55
7.2.310.0150.00616.39
7.2.300.0080.00816.87
7.2.290.0100.01016.54
7.2.130.0120.01016.55
7.2.120.0070.00716.65
7.2.110.0070.00716.41
7.2.100.0090.00916.69
7.2.90.0030.01016.65
7.2.80.0090.00916.63
7.2.70.0100.00716.97
7.2.60.0070.00917.06
7.2.50.0030.01016.75
7.2.40.0110.00717.04
7.2.30.0040.01517.04
7.2.20.0090.00316.69
7.2.10.0070.00716.76
7.2.00.0060.00518.20
7.1.250.0060.00915.56
7.1.200.0100.00315.62
7.1.100.0090.00318.18
7.1.70.0000.00817.09
7.1.60.0030.02019.85
7.1.00.0100.07322.45
7.0.200.1700.00614.46
7.0.60.0170.05719.91
7.0.50.0200.05320.32
7.0.40.0230.05720.22
7.0.30.0170.07320.22
7.0.20.0270.05320.45
7.0.10.0330.04720.23
7.0.00.0070.06720.34
5.6.280.0030.07320.79
5.6.210.0100.06020.79
5.6.200.0130.06021.06
5.6.190.0100.06021.08
5.6.180.0230.05021.04
5.6.170.0270.05721.18
5.6.160.0200.06021.06
5.6.150.0100.06021.10
5.6.140.0200.06021.14
5.6.130.0230.05020.96
5.6.120.0270.04721.14
5.6.110.0200.06021.05
5.6.100.0270.07321.07
5.6.90.0270.06021.02
5.6.80.0300.05320.44
5.6.70.0130.06320.40
5.6.60.0130.05720.41
5.6.50.0300.04020.42
5.6.40.0270.04320.48
5.6.30.0130.05720.38
5.6.20.0230.04720.48
5.6.10.0100.06720.56
5.6.00.0130.06720.38
5.5.350.0200.05720.36
5.5.340.0300.05020.95
5.5.330.0170.05720.71
5.5.320.0370.05020.96
5.5.310.0170.06320.99
5.5.300.0100.06320.87
5.5.290.0170.06320.81
5.5.280.0100.06720.96
5.5.270.0170.07321.03
5.5.260.0370.06020.79
5.5.250.0330.07320.65
5.5.240.0230.05320.34
5.5.230.0270.05020.36
5.5.220.0100.06720.33
5.5.210.0130.06020.24
5.5.200.0130.05720.07
5.5.190.0130.05720.35
5.5.180.0100.06020.10
5.5.160.0270.05720.19
5.5.150.0030.06720.21
5.5.140.0130.06020.15
5.5.130.0200.05020.17
5.5.120.0130.05320.21
5.5.110.0130.05320.14
5.5.100.0100.05319.96
5.5.90.0270.04720.11
5.5.80.0670.03720.14
5.5.70.0330.06320.16
5.5.60.0430.05320.10
5.5.50.0470.05720.00
5.5.40.0630.04720.10
5.5.30.0500.05019.91
5.5.20.0400.06020.16
5.5.10.0600.04020.24
5.5.00.0500.05720.07

preferences:
51.47 ms | 1749 KiB | 5 Q