3v4l.org

run code in 300+ PHP versions simultaneously
<?php function substr_count_array( $haystack, $needle ) { $count = 0; foreach ($needle as $substring) { $count += substr_count( $haystack, $substring); } return $count; } $str = 'The fox jumped over the table and ate a frog'; $search = 'fox ate apple'; $words = explode(' ', $search); $result = substr_count_array($str, $words); $total_words = sizeof($words); $relative = ($result / $total_words) * 100; if($relative > 50) { echo $relative. '% related to your query (Total words: '.$total_words.', Words found: '.$result.')'; } else { echo 'Could not find anything related'; }

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.40.0140.00718.89
8.3.30.0140.00019.04
8.3.20.0090.00620.34
8.3.10.0040.00423.48
8.3.00.0080.00020.94
8.2.170.0090.00622.96
8.2.160.0070.01020.39
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0080.00020.72
8.2.110.0000.00921.91
8.2.100.0090.00318.03
8.2.90.0000.00817.68
8.2.80.0000.00917.97
8.2.70.0040.00417.75
8.2.60.0090.00018.03
8.2.50.0030.00718.07
8.2.40.0040.00418.28
8.2.30.0090.00018.23
8.2.20.0040.00417.63
8.2.10.0070.00018.17
8.2.00.0080.00017.67
8.1.270.0050.00323.87
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0050.00522.24
8.1.230.0030.01017.42
8.1.220.0070.00017.76
8.1.210.0040.00418.91
8.1.200.0030.00617.35
8.1.190.0080.00017.38
8.1.180.0000.00818.10
8.1.170.0040.00418.65
8.1.160.0040.00422.08
8.1.150.0000.00718.52
8.1.140.0040.00417.41
8.1.130.0000.00717.75
8.1.120.0000.00717.36
8.1.110.0040.00417.43
8.1.100.0040.00717.50
8.1.90.0030.00417.47
8.1.80.0000.00717.50
8.1.70.0000.00817.45
8.1.60.0050.00317.48
8.1.50.0030.00617.41
8.1.40.0000.00717.56
8.1.30.0060.00317.55
8.1.20.0040.00417.49
8.1.10.0030.00617.42
8.1.00.0030.00617.46
8.0.300.0000.00719.71
8.0.290.0000.00716.75
8.0.280.0030.00318.50
8.0.270.0000.00717.31
8.0.260.0000.00617.22
8.0.250.0020.00516.97
8.0.240.0040.00416.96
8.0.230.0040.00416.98
8.0.220.0000.00716.94
8.0.210.0030.00316.84
8.0.200.0040.00416.82
8.0.190.0030.00316.97
8.0.180.0000.00716.93
8.0.170.0050.00316.81
8.0.160.0050.00316.79
8.0.150.0000.00716.84
8.0.140.0000.00916.75
8.0.130.0050.00013.31
8.0.120.0080.00016.87
8.0.110.0000.00816.79
8.0.100.0030.00316.80
8.0.90.0040.00416.84
8.0.80.0120.00916.91
8.0.70.0000.00716.79
8.0.60.0070.00016.79
8.0.50.0000.00816.69
8.0.30.0080.01217.00
8.0.20.0110.00817.40
8.0.10.0000.00717.07
8.0.00.0070.01016.87
7.4.330.0030.00315.14
7.4.320.0030.00316.52
7.4.300.0000.00616.49
7.4.290.0000.00816.46
7.4.280.0090.00316.55
7.4.270.0030.00316.42
7.4.260.0030.00316.46
7.4.250.0000.00716.46
7.4.240.0020.00516.55
7.4.230.0060.00316.41
7.4.220.0090.01616.46
7.4.210.0030.01216.53
7.4.200.0030.00316.48
7.4.160.0090.00616.68
7.4.150.0090.01017.40
7.4.140.0150.00517.86
7.4.130.0090.00816.56
7.4.120.0100.00616.50
7.4.110.0070.01016.48
7.4.100.0100.01616.36
7.4.90.0090.01216.66
7.4.80.0160.00719.39
7.4.70.0100.00716.67
7.4.60.0060.01016.55
7.4.50.0050.00216.32
7.4.40.0040.01216.45
7.4.30.0090.00616.61
7.4.10.0070.01014.70
7.4.00.0090.00914.94
7.3.330.0030.00313.37
7.3.320.0000.00613.07
7.3.310.0070.00016.21
7.3.300.0000.00716.31
7.3.290.0030.01016.37
7.3.280.0080.00816.35
7.3.270.0060.01117.40
7.3.260.0090.00916.39
7.3.250.0110.00816.55
7.3.240.0120.00616.32
7.3.230.0100.00716.51
7.3.210.0140.00416.42
7.3.200.0060.01019.39
7.3.190.0100.01316.58
7.3.180.0100.01216.62
7.3.170.0100.00616.27
7.3.160.0140.00716.45
7.3.130.0100.01014.75
7.3.120.0080.00915.04
7.3.110.0090.00914.77
7.3.100.0090.00414.67
7.3.90.0060.00714.86
7.3.80.0070.00514.81
7.3.70.0080.00914.82
7.3.60.0040.00714.76
7.3.50.0110.00514.85
7.3.40.0080.00514.63
7.3.30.0070.00514.82
7.3.20.0080.00816.74
7.3.10.0080.00616.68
7.3.00.0100.00616.71
7.2.330.0090.00916.75
7.2.320.0170.00716.79
7.2.310.0130.00316.69
7.2.300.0120.00416.81
7.2.290.0140.00616.66
7.2.260.0070.01115.25
7.2.250.0140.00514.92
7.2.240.0050.01014.94
7.2.230.0070.00815.12
7.2.220.0060.00914.95
7.2.210.0040.00715.01
7.2.200.0060.00815.06
7.2.190.0050.00714.85
7.2.180.0080.00815.18
7.2.170.0060.00514.92
7.2.160.0030.01215.21
7.2.150.0070.00717.00
7.2.140.0130.00217.05
7.2.130.0090.00716.77
7.2.120.0050.00917.02
7.2.110.0080.00516.96
7.2.100.0050.00716.92
7.2.90.0060.00716.82
7.2.80.0070.00716.87
7.2.70.0030.01116.92
7.2.60.0090.00617.06
7.2.50.0070.00316.91
7.2.40.0020.01216.99
7.2.30.0090.00616.97
7.2.20.0050.00717.04
7.2.10.0060.00716.97
7.2.00.0020.01317.48
7.1.330.0060.01015.86
7.1.320.0010.01315.90
7.1.310.0030.01015.90
7.1.300.0060.00715.84
7.1.290.0030.01215.72
7.1.280.0020.01115.81
7.1.270.0050.00715.96
7.1.260.0060.00715.88
7.1.250.0060.00515.72
7.1.240.0070.00715.75
7.1.230.0070.00315.84
7.1.220.0000.00815.90
7.1.210.0070.00715.78
7.1.200.0070.00715.66
7.1.190.0000.01415.65
7.1.180.0080.00815.75
7.1.170.0070.00315.57
7.1.160.0120.00015.75
7.1.150.0070.00715.55
7.1.140.0030.01015.76
7.1.130.0000.00815.79
7.1.120.0030.00715.90
7.1.110.0060.00615.89
7.1.100.0060.00617.03
7.1.90.0060.00615.85
7.1.80.0080.00415.85
7.1.70.0050.00316.55
7.1.60.0110.00917.78
7.1.50.0040.01316.17
7.1.40.0070.00715.81
7.1.30.0090.00615.99
7.1.20.0060.01115.91
7.1.10.0050.00915.75
7.1.00.0020.04318.97
7.0.330.0060.00615.15
7.0.320.0060.00615.45
7.0.310.0070.00315.45
7.0.300.0070.00715.35
7.0.290.0080.00315.50
7.0.280.0030.00915.25
7.0.270.0000.01215.47
7.0.260.0030.00615.41
7.0.250.0040.00715.30
7.0.240.0040.00415.55
7.0.230.0050.00515.48
7.0.220.0030.01015.55
7.0.210.0040.00815.43
7.0.200.0130.00615.16
7.0.190.0030.01015.44
7.0.180.0030.00815.25
7.0.170.0060.00615.37
7.0.160.0090.00315.51
7.0.150.0000.01315.40
7.0.140.0070.03918.68
7.0.130.0110.00715.42
7.0.120.0030.01015.42
7.0.110.0030.01015.29
7.0.100.0000.01415.41
7.0.90.0040.00715.55
7.0.80.0040.01215.45
7.0.70.0060.01015.38
7.0.60.0080.02017.67
7.0.50.0050.02416.59
7.0.40.0070.02116.97
7.0.30.0100.02916.82
7.0.20.0170.04316.82
7.0.10.0070.02516.75
7.0.00.0070.02316.83
5.6.400.0120.00314.45
5.6.390.0060.00914.76
5.6.380.0060.00914.52
5.6.370.0000.01714.65
5.6.360.0070.00714.39
5.6.350.0070.01014.63
5.6.340.0040.00814.60
5.6.330.0000.01414.20
5.6.320.0030.01014.62
5.6.310.0000.01314.62
5.6.300.0060.00914.68
5.6.290.0070.00714.57
5.6.280.0070.00714.43
5.6.270.0030.01214.71
5.6.260.0060.00914.52
5.6.250.0070.00714.57
5.6.240.0030.01014.15
5.6.230.0040.00714.45
5.6.220.0070.00714.30
5.6.210.0100.02917.37
5.6.200.0070.03016.24
5.6.190.0130.03817.21
5.6.180.1900.02317.33
5.6.170.0320.03217.38
5.6.160.0100.04417.39
5.6.150.0030.02816.22
5.6.140.0050.04416.38
5.6.130.0060.04516.21
5.6.120.0080.02817.72
5.6.110.0070.04317.65
5.6.100.0050.04617.76
5.6.90.0130.03317.67
5.6.80.0070.04517.38
5.6.70.0060.03117.48
5.6.60.0030.01214.27
5.6.50.0060.00314.08
5.6.40.0070.00314.08
5.6.30.0110.00714.16
5.6.20.0100.00314.31
5.6.10.0070.00714.54
5.6.00.0040.00814.47
5.5.380.0080.00314.56
5.5.370.0060.00614.32
5.5.360.0070.00714.47
5.5.350.0170.02217.40
5.5.340.0100.03016.25
5.5.330.0050.03817.32
5.5.320.0150.02617.37
5.5.310.0170.04617.19
5.5.300.0120.04016.06
5.5.290.0060.03116.22
5.5.280.0070.03517.64
5.5.270.0070.03017.49
5.5.260.0050.04117.37
5.5.250.0100.02717.56
5.5.240.0140.04017.16
5.5.230.0070.00713.96
5.5.220.0090.00614.25
5.5.210.0040.00414.16
5.5.200.0000.00814.27
5.5.190.0000.00814.27
5.5.180.0070.00714.12
5.5.170.0040.00414.17
5.5.160.0070.00414.29
5.5.150.0000.00814.08
5.5.140.0000.01314.25
5.5.130.0120.00614.03
5.5.120.0040.01214.44
5.5.110.0100.00714.33
5.5.100.0060.01014.31
5.5.90.0030.01014.40
5.5.80.0030.01414.19
5.5.70.0000.01414.40
5.5.60.0040.00414.01
5.5.50.0030.00714.41
5.5.40.0040.01113.82
5.5.30.0030.01014.38
5.5.20.0060.00614.11
5.5.10.0070.01113.92
5.5.00.0130.00414.12
5.4.450.0100.03315.35
5.4.440.0100.04115.18
5.4.430.0110.03515.21
5.4.420.0080.03415.17
5.4.410.0180.03515.19
5.4.400.0050.04014.94
5.4.390.0080.03815.12
5.4.380.0070.03915.00
5.4.370.0110.03315.07
5.4.360.0120.04215.06
5.4.350.0130.03815.12
5.4.340.0130.03315.02
5.4.330.0060.00011.06
5.4.320.0080.04315.17
5.4.310.0030.02614.96
5.4.300.0060.03215.24
5.4.290.0070.04315.10
5.4.280.0070.03215.18
5.4.270.0140.03514.87
5.4.260.0170.02215.06
5.4.250.0130.02615.19
5.4.240.0050.04515.05
5.4.230.0080.02515.13
5.4.220.0100.02114.95
5.4.210.0100.02215.16
5.4.200.0150.02515.02
5.4.190.0080.02715.05
5.4.180.0100.02015.01
5.4.170.0180.01814.87
5.4.160.0100.02314.93
5.4.150.0170.01715.13
5.4.140.0150.01713.73
5.4.130.0140.01913.61
5.4.120.0150.03213.71
5.4.110.0130.01713.66
5.4.100.0130.02013.67
5.4.90.0170.02213.91
5.4.80.0140.01713.85
5.4.70.0160.01513.71
5.4.60.0080.02513.79
5.4.50.0080.02313.83
5.4.40.0080.02613.68
5.4.30.0080.02513.68
5.4.20.0080.02413.89
5.4.10.0140.02513.66
5.4.00.0110.02013.42
5.3.290.0030.03112.83
5.3.280.0070.02012.71
5.3.270.0100.02412.76
5.3.260.0140.01912.70
5.3.250.0110.02212.70
5.3.240.0100.02112.71
5.3.230.0050.02412.73
5.3.220.0100.02212.64
5.3.210.0100.01812.68
5.3.200.0120.02412.67
5.3.190.0070.02312.79
5.3.180.0120.01812.70
5.3.170.0090.02212.66
5.3.160.0110.02212.68
5.3.150.0120.02312.74
5.3.140.0130.01812.67
5.3.130.0100.02412.63
5.3.120.0100.02412.70
5.3.110.0160.02412.67
5.3.100.0110.01912.36
5.3.90.0070.02512.39
5.3.80.0120.02112.36
5.3.70.0130.01812.36
5.3.60.0090.02212.35
5.3.50.0110.02012.33
5.3.40.0100.02912.32
5.3.30.0170.03712.39
5.3.20.0160.03812.28
5.3.10.0160.03312.33
5.3.00.0100.03012.17
5.2.170.0130.02013.39
5.2.160.0100.03713.39
5.2.150.0230.06313.39
5.2.140.0170.05013.39
5.2.130.0170.05713.39
5.2.120.0200.06013.39
5.2.110.0300.04713.39
5.2.100.0200.05313.39
5.2.90.0230.05313.39
5.2.80.0200.05713.39
5.2.70.0200.04013.39
5.2.60.0230.05713.39
5.2.50.0170.04313.39
5.2.40.0170.07013.39
5.2.30.0170.05713.39
5.2.20.0100.04313.39
5.2.10.0100.04313.39
5.2.00.0100.06013.39
5.1.60.0130.02713.39
5.1.50.0200.04313.39
5.1.40.0130.04013.39
5.1.30.0130.05713.39
5.1.20.0170.05313.39
5.1.10.0070.05013.39
5.1.00.0070.05713.39
5.0.50.0000.03313.39
5.0.40.0030.02713.39
5.0.30.0070.05313.39
5.0.20.0070.03713.39
5.0.10.0030.02713.39
5.0.00.0000.03713.39
4.4.90.0030.03713.39
4.4.80.0070.03313.39
4.4.70.0030.03313.39
4.4.60.0030.03713.39
4.4.50.0030.03013.39
4.4.40.0070.04013.39
4.4.30.0100.03013.39
4.4.20.0000.03313.39
4.4.10.0000.03713.39
4.4.00.0070.04013.39
4.3.110.0000.03713.39
4.3.100.0000.02713.39
4.3.90.0030.02313.39
4.3.80.0070.05313.39
4.3.70.0030.02713.39
4.3.60.0030.03713.39
4.3.50.0100.03313.39
4.3.40.0000.04313.39
4.3.30.0030.03713.39
4.3.20.0070.03313.39
4.3.10.0000.03713.39
4.3.00.0070.02013.39

preferences:
43.87 ms | 400 KiB | 5 Q