3v4l.org

run code in 200+ PHP versions simultaneously
<?php $s = "01001010101101111011101001010100010101101010101010101101101010010110110110"; $n = 10; for($a=$b=$c=0;(($d=@substr_count($s,1,$a,$n))>$c&&(($b=$a)&&($c=$d)))||$a<strlen($s);$a++);echo $b; var_dump($i,$best,$bestCount);
based on uJd9E

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)
7.4.60.0100.00716.46
7.4.50.0030.00616.63
7.4.00.0100.00515.13
7.3.180.0110.00516.32
7.3.120.0100.00614.65
7.3.110.0000.01814.96
7.3.100.0150.00314.75
7.3.90.0070.00715.00
7.3.80.0000.01514.86
7.3.70.0100.00314.69
7.3.60.0040.00714.84
7.3.50.0100.01014.55
7.3.40.0030.01214.76
7.3.30.0060.00614.93
7.3.20.0060.01016.75
7.3.10.0090.00416.66
7.3.00.0050.00816.59
7.2.250.0070.01115.20
7.2.240.0070.01315.03
7.2.230.0120.00315.02
7.2.220.0030.00615.07
7.2.210.0070.00715.19
7.2.200.0110.00415.00
7.2.190.0000.01614.87
7.2.180.0030.01014.78
7.2.170.0070.00414.95
7.2.160.0040.01115.05
7.2.150.0060.01016.59
7.2.140.0140.00016.52
7.2.130.0060.00916.74
7.2.120.0070.01116.91
7.2.110.0050.01316.66
7.2.100.0060.01116.92
7.2.90.0090.00816.83
7.2.80.0070.00516.82
7.2.70.0030.00917.02
7.2.60.0060.00716.73
7.2.50.0050.01216.93
7.2.40.0070.00516.87
7.2.30.0050.00817.06
7.2.20.0050.00916.61
7.2.10.0090.00316.82
7.2.00.0020.00916.75
7.1.330.0130.00615.63
7.1.320.0000.00915.95
7.1.310.0030.01215.74
7.1.300.0120.00315.84
7.1.290.0070.01115.81
7.1.280.0080.00415.67
7.1.270.0030.01315.55
7.1.260.0070.00715.80
7.1.250.0020.01215.77
7.1.240.0090.00615.64
7.1.230.0060.00615.70
7.1.220.0070.00315.99
7.1.210.0070.01015.81
7.1.200.0160.00515.67
7.1.190.0090.00015.68
7.1.180.0120.00315.60
7.1.170.0090.00615.84
7.1.160.0000.01815.78
7.1.150.0040.00815.46
7.1.140.0110.00415.88
7.1.130.0030.01315.95
7.1.120.0030.00915.78
7.1.110.0030.01015.68
7.1.100.0030.00915.77
7.1.90.0030.01016.04
7.1.80.0030.01015.64
7.1.70.0070.00916.62
7.1.60.0020.01617.58
7.1.50.0060.01016.24
7.1.40.0080.00015.93
7.1.30.0000.00815.68
7.1.20.0000.00915.72
7.1.10.0050.00315.75
7.1.00.0060.03819.08
7.0.330.0030.00715.38
7.0.320.0030.00615.52
7.0.310.0000.01415.17
7.0.300.0080.00015.46
7.0.290.0000.00815.42
7.0.280.0000.00915.34
7.0.270.0060.00315.46
7.0.260.0040.01215.40
7.0.250.0100.00315.22
7.0.240.0000.01215.36
7.0.230.0120.00415.32
7.0.220.0060.00615.35
7.0.210.0100.00715.48
7.0.200.0310.00914.99
7.0.190.0030.00715.45
7.0.180.0030.01015.43
7.0.170.0060.00915.43
7.0.160.0000.01415.48
7.0.150.0030.00715.21
7.0.140.0040.03518.67
7.0.130.0080.00415.59
7.0.120.0070.00315.51
7.0.110.0090.00615.21
7.0.100.0030.00515.48
7.0.90.0030.00515.59
7.0.80.0070.00315.38
7.0.70.0120.00015.48
7.0.60.0010.02817.56
7.0.50.0060.02816.74
7.0.40.0080.04116.94
7.0.30.0190.04016.71
7.0.20.0250.03816.81
7.0.10.0050.03216.86
7.0.00.0020.05016.64
5.6.400.0040.01214.16
5.6.390.0090.00614.38
5.6.380.0090.00414.47
5.6.370.0100.00313.89
5.6.360.0030.01414.06
5.6.350.0030.00914.59
5.6.340.0040.00814.21
5.6.330.0040.01114.39
5.6.320.0110.00014.29
5.6.310.0080.00414.43
5.6.300.0080.00614.17
5.6.290.0060.00814.08
5.6.280.0100.03217.66
5.6.270.0040.00414.27
5.6.260.0140.00014.41
5.6.250.0060.00814.30
5.6.240.0060.00614.44
5.6.230.0040.01114.70
5.6.220.0030.00914.37
5.6.210.0070.04217.47
5.6.200.0090.03616.22
5.6.190.0050.02717.24
5.6.180.0280.03817.33
5.6.170.0810.03217.45
5.6.160.0090.04017.32
5.6.150.0080.04216.26
5.6.140.0070.02216.24
5.6.130.0110.02916.31
5.6.120.0050.05217.74
5.6.110.0070.02817.71
5.6.100.0110.03017.68
5.6.90.0040.02917.56
5.6.80.0100.03817.29
5.6.70.0100.00314.15
5.6.60.0070.00714.34
5.6.50.0090.00613.95
5.6.40.0090.00914.23
5.6.30.0060.01014.28
5.6.20.0110.00614.30
5.6.10.0070.00713.91
5.6.00.0090.00014.15
5.5.380.0000.01514.21
5.5.370.0030.00614.15
5.5.360.0000.01213.67
5.5.350.0100.04017.27
5.5.340.0030.04215.97
5.5.330.0070.04217.31
5.5.320.0220.04117.11
5.5.310.0170.03917.28
5.5.300.0120.04216.11
5.5.290.0070.04516.03
5.5.280.0030.04317.50
5.5.270.0080.04517.54
5.5.260.0050.05017.46
5.5.250.0060.02617.28
5.5.240.0030.04617.29
5.5.230.0030.01014.04
5.5.220.0030.01013.86
5.5.210.0060.00914.25
5.5.200.0000.01214.18
5.5.190.0040.00414.11
5.5.180.0040.00713.98
5.5.170.0000.01014.20
5.5.160.0060.00913.93
5.5.150.0000.01414.36
5.5.140.0030.00614.18
5.5.130.0030.00713.95
5.5.120.0100.00613.88
5.5.110.0070.01013.96
5.5.100.0080.00414.00
5.5.90.0030.01014.05
5.5.80.0030.01313.89
5.5.70.0030.01013.82
5.5.60.0130.00313.91
5.5.50.0030.00714.07
5.5.40.0070.00714.17
5.5.30.0030.01014.01
5.5.20.0060.00614.14
5.5.10.0070.00714.11
5.5.00.0080.00413.97
5.4.450.0220.02815.30
5.4.440.0230.03315.07
5.4.430.0070.02915.13
5.4.420.0110.02815.04
5.4.410.0150.02615.13
5.4.400.0080.02714.82
5.4.390.0060.03114.93
5.4.380.0120.02914.85
5.4.370.0140.02314.71
5.4.360.0110.02514.73
5.4.350.0080.03012.20
5.4.340.0120.02212.21
5.4.330.0040.00710.63
5.4.320.0100.02912.55
5.4.310.0160.02612.37
5.4.300.0210.02112.42
5.4.290.0110.02812.35
5.4.280.0050.03212.43
5.4.270.0070.03012.43
5.4.260.0020.03312.60
5.4.250.0080.03012.55
5.4.240.0090.02612.44
5.4.230.0080.02712.58
5.4.220.0000.03512.45
5.4.210.0580.02912.49
5.4.200.0100.02512.50
5.4.190.0100.02012.36
5.4.180.0100.02712.34
5.4.170.0180.02312.43
5.4.160.0050.02912.16
5.4.150.0080.02512.36
5.4.140.0020.03312.05
5.4.130.0110.02312.20
5.4.120.0150.01812.37
5.4.110.0100.02612.43
5.4.100.0050.02812.24
5.4.90.0080.02812.28
5.4.80.0080.02712.33
5.4.70.0030.03212.30
5.4.60.0100.02512.24
5.4.50.0050.03012.38
5.4.40.0080.02412.30
5.4.30.0090.02512.40
5.4.20.0100.02512.33
5.4.10.0090.02712.36
5.4.00.0060.03012.04
5.3.290.0100.05714.67
5.3.280.0170.04714.52
5.3.270.0200.04714.65
5.3.260.0100.05314.63
5.3.250.0230.04314.57
5.3.240.0370.05014.62
5.3.230.0100.05014.45
5.3.220.0130.05014.49
5.3.210.0400.05714.59
5.3.200.0230.03714.49
5.3.190.0270.04014.59
5.3.180.0130.05314.41
5.3.170.0070.06014.59
5.3.160.0370.06014.59
5.3.150.0130.06714.46
5.3.140.0100.04714.46
5.3.130.0130.05314.48
5.3.120.0070.05714.51
5.3.110.0170.05014.46
5.3.100.0130.05014.00
5.3.90.0100.05014.08
5.3.80.0100.05014.01
5.3.70.0170.04013.91
5.3.60.0100.05013.85
5.3.50.0100.04713.79
5.3.40.0100.04713.84
5.3.30.0130.05313.78
5.3.20.0230.03713.55
5.3.10.0070.05713.69
5.3.00.0130.05713.57
5.2.170.0130.04011.03
5.2.160.0170.05011.04
5.2.150.0170.03711.15
5.2.140.0170.03311.06
5.2.130.0130.03711.00
5.2.120.0030.04711.17
5.2.110.0030.04711.03
5.2.100.0100.03311.10
5.2.90.0130.03711.06
5.2.80.0230.03011.15
5.2.70.0200.04310.96
5.2.60.0070.04711.01
5.2.50.0200.04011.02
5.2.40.0100.03711.04
5.2.30.0070.04010.98
5.2.20.0130.03310.84
5.2.10.0130.03310.89
5.2.00.0100.04310.64
5.1.60.0070.0339.95
5.1.50.0100.03310.03
5.1.40.0130.0679.94
5.1.30.0370.02710.31
5.1.20.0130.04010.28
5.1.10.0070.04010.15
5.1.00.0130.03010.00
5.0.50.0070.0278.46
5.0.40.0000.0338.34
5.0.30.0030.0438.25
5.0.20.0030.0278.15
5.0.10.0170.0278.23
5.0.00.0300.0338.24
4.4.90.0230.0235.85
4.4.80.0030.0205.82
4.4.70.0030.0235.82
4.4.60.0030.0235.79
4.4.50.0000.0275.85
4.4.40.0070.0305.82
4.4.30.0070.0205.84
4.4.20.0030.0275.84
4.4.10.0130.0175.85
4.4.00.0030.0305.79
4.3.110.0070.0235.77
4.3.100.0100.0205.75
4.3.90.0100.0135.79
4.3.80.0170.0335.75
4.3.70.0030.0205.70
4.3.60.0070.0205.89
4.3.50.0200.0205.73
4.3.40.0030.0405.86
4.3.30.0070.0204.58
4.3.20.0030.0234.56
4.3.10.0030.0234.52
4.3.00.0100.0236.73