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 '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.70.0120.00616.63
8.3.60.0070.00716.88
8.3.50.0130.00522.02
8.3.40.0140.00018.67
8.3.30.0080.00619.07
8.3.20.0040.00420.34
8.3.10.0040.00423.56
8.3.00.0070.00020.84
8.2.180.0110.01116.75
8.2.170.0120.00322.96
8.2.160.0030.01020.52
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00320.69
8.2.110.0060.00322.01
8.2.100.0120.00020.57
8.2.90.0050.00519.35
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0030.00918.05
8.2.50.0060.00318.07
8.2.40.0060.00320.07
8.2.30.0060.00318.31
8.2.20.0050.00317.65
8.2.10.0040.00418.01
8.2.00.0030.00517.65
8.1.280.0140.00025.92
8.1.270.0000.00823.84
8.1.260.0080.00026.35
8.1.250.0030.00628.09
8.1.240.0030.00622.19
8.1.230.0110.00019.14
8.1.220.0040.00417.74
8.1.210.0040.00718.77
8.1.200.0030.00617.35
8.1.190.0060.00317.36
8.1.180.0000.00818.10
8.1.170.0030.00618.53
8.1.160.0000.00721.91
8.1.150.0040.00418.59
8.1.140.0040.00417.44
8.1.130.0000.00717.82
8.1.120.0000.00717.49
8.1.110.0080.00017.47
8.1.100.0030.00617.43
8.1.90.0040.00417.43
8.1.80.0040.00417.50
8.1.70.0030.00317.43
8.1.60.0040.00417.59
8.1.50.0090.00017.59
8.1.40.0040.00417.46
8.1.30.0040.00717.57
8.1.20.0030.00517.70
8.1.10.0000.00717.57
8.1.00.0040.00417.42
8.0.300.0080.00018.77
8.0.290.0020.00516.63
8.0.280.0030.00318.43
8.0.270.0000.00717.17
8.0.260.0030.00317.17
8.0.250.0000.00616.93
8.0.240.0050.00516.98
8.0.230.0000.00716.95
8.0.220.0070.00016.86
8.0.210.0040.00316.96
8.0.200.0060.00016.99
8.0.190.0000.00816.83
8.0.180.0050.00216.89
8.0.170.0050.00316.93
8.0.160.0040.00416.89
8.0.150.0060.00616.78
8.0.140.0060.00316.70
8.0.130.0000.00513.36
8.0.120.0040.00416.87
8.0.110.0040.00416.78
8.0.100.0030.00316.75
8.0.90.0000.00816.90
8.0.80.0070.00716.94
8.0.70.0050.00316.82
8.0.60.0040.00416.87
8.0.50.0040.00416.70
8.0.30.0110.00817.04
8.0.20.0160.00317.40
8.0.10.0040.00416.98
8.0.00.0110.00616.62
7.4.330.0000.00515.00
7.4.320.0060.00016.61
7.4.300.0000.00616.42
7.4.290.0000.00916.60
7.4.280.0070.00316.40
7.4.270.0040.00416.43
7.4.260.0030.00716.57
7.4.250.0000.00816.53
7.4.240.0040.00416.55
7.4.230.0060.00316.71
7.4.220.0100.00716.63
7.4.210.0080.00816.66
7.4.200.0030.00316.48
7.4.160.0110.00916.37
7.4.150.0100.00717.40
7.4.140.0060.01117.86
7.4.130.0090.00816.64
7.4.120.0100.00716.47
7.4.110.0130.00416.54
7.4.100.0100.00716.55
7.4.90.0030.01416.62
7.4.80.0140.00519.39
7.4.70.0100.00616.57
7.4.60.0090.00616.42
7.4.50.0000.00516.48
7.4.40.0070.01016.60
7.4.30.0050.01016.57
7.4.00.0100.00615.02
7.3.330.0050.00013.31
7.3.320.0050.00013.16
7.3.310.0070.00016.46
7.3.300.0000.00716.25
7.3.290.0060.00816.34
7.3.280.0040.01416.34
7.3.270.0110.00717.40
7.3.260.0130.01216.47
7.3.250.0130.01116.58
7.3.240.0000.02116.39
7.3.230.0060.01016.44
7.3.210.0070.01116.34
7.3.200.0110.01519.39
7.3.190.0060.01616.50
7.3.180.0130.00416.36
7.3.170.0070.01016.51
7.3.160.0100.01016.50
7.3.120.0030.01314.77
7.2.330.0100.01316.62
7.2.320.0040.01816.40
7.2.310.0100.01216.57
7.2.300.0070.01016.78
7.2.290.0090.00816.65
7.2.60.0040.01117.03
7.2.50.0040.01217.01
7.1.200.0080.00315.55
7.1.70.0000.00716.98
7.1.60.0070.01819.70
7.1.50.0130.01016.87
7.1.00.0030.07722.39
7.0.200.0260.00614.75
7.0.140.0030.07321.92
7.0.110.0230.04720.00
7.0.100.0200.04019.98
7.0.90.0230.03320.02
7.0.80.0070.04719.84
7.0.70.0130.03319.94
7.0.60.0400.06719.91
7.0.50.0500.07020.27
7.0.40.0130.04320.06
7.0.30.0130.07020.13
7.0.20.0070.07020.16
7.0.10.0200.06720.11
7.0.00.0100.07720.02
5.6.280.0100.06721.10
5.6.260.0070.04720.69
5.6.250.0070.03720.59
5.6.240.0070.04020.63
5.6.230.0030.05020.64
5.6.220.0030.04320.66
5.6.210.0000.04320.63
5.6.200.0030.08721.03
5.6.190.0070.08321.20
5.6.180.0030.08021.27
5.6.170.0100.04321.19
5.6.160.0100.06321.18
5.6.150.0000.08321.19
5.6.140.0130.07720.88
5.6.130.0130.07020.93
5.6.120.0100.07320.95
5.6.110.0030.08721.26
5.6.100.0070.06021.26
5.6.90.0170.07020.93
5.6.80.0130.07020.34
5.6.70.0100.07020.52
5.6.60.0100.08020.56
5.6.50.0100.06720.30
5.6.40.0100.07720.30
5.6.30.0130.07720.63
5.6.20.0100.07720.34
5.6.10.0130.06720.48
5.6.00.0130.06720.28
5.5.380.0030.04320.47
5.5.370.0000.04320.55
5.5.360.0000.04320.37
5.5.350.0070.03720.48
5.5.340.0170.07020.98
5.5.330.0030.08720.95
5.5.320.0030.07320.91
5.5.310.0030.08020.82
5.5.300.0070.08720.82
5.5.290.0230.06720.81
5.5.280.0030.08720.95
5.5.270.0070.06320.86
5.5.260.0130.06720.80
5.5.250.0000.08320.79
5.5.240.0130.07020.43
5.5.230.0030.08320.36
5.5.220.0030.05720.42
5.5.210.0130.07020.34
5.5.200.0130.06720.11
5.5.190.0170.07320.31
5.5.180.0170.07320.13
5.5.160.0100.07020.30
5.5.150.0100.06720.10
5.5.140.0070.06020.34
5.5.130.0170.06020.25
5.5.120.0170.06320.22
5.5.110.0030.08320.13
5.5.100.0100.08020.06
5.5.90.0100.04320.11
5.5.80.0000.04720.20
5.5.70.0170.06720.07
5.5.60.0100.07320.06
5.5.50.0030.07320.01
5.5.40.0100.06720.04
5.5.30.0100.05020.04
5.5.20.0070.06320.07
5.5.10.0100.07320.12
5.5.00.0200.05020.00
5.4.450.0130.07719.34
5.4.440.0130.06719.30
5.4.430.0030.05019.39
5.4.420.0100.07719.45
5.4.410.0100.07019.34
5.4.400.0130.07319.23
5.4.390.0070.07019.23
5.4.380.0000.08019.23
5.4.370.0000.08019.18
5.4.360.0030.08018.94
5.4.350.0100.07719.02
5.4.340.0070.06719.00
5.4.320.0100.07018.98
5.4.310.0070.06719.23
5.4.300.0100.06318.97
5.4.290.0070.06719.30
5.4.280.0130.07019.15
5.4.270.0000.05318.98
5.4.260.0030.07719.02
5.4.250.0070.06719.32
5.4.240.0070.07019.00
5.4.230.0100.07319.07
5.4.220.0030.07719.02
5.4.210.0070.07318.97
5.4.200.0100.07318.97
5.4.190.0070.04719.21
5.4.180.0070.07018.99
5.4.170.0030.07719.21
5.4.160.0100.07019.16
5.4.150.0000.08018.96
5.4.140.0070.06716.39
5.4.130.0130.06316.50
5.4.120.0100.07016.38
5.4.110.0070.07016.26
5.4.100.0100.06016.41
5.4.90.0130.06716.46
5.4.80.0030.07716.57
5.4.70.0070.07316.55
5.4.60.0000.06716.37
5.4.50.0070.07016.38
5.4.40.0130.06316.56
5.4.30.0070.07716.62
5.4.20.0070.07016.26
5.4.10.0170.05316.56
5.4.00.0030.07015.73
5.3.290.0070.07714.64
5.3.280.0170.06714.62
5.3.270.0070.07714.69
5.3.260.0070.07714.60
5.3.250.0100.06314.61
5.3.240.0100.07314.57
5.3.230.0030.07314.74
5.3.220.0100.07014.60
5.3.210.0030.08014.58
5.3.200.0030.07714.58
5.3.190.0070.06714.55
5.3.180.0070.06014.59
5.3.170.0070.04314.42
5.3.160.0030.07314.79
5.3.150.0130.06014.56
5.3.140.0100.04014.41
5.3.130.0100.07014.64
5.3.120.0030.06014.57
5.3.110.0100.07014.40
5.3.100.0070.07314.07
5.3.90.0100.06714.11
5.3.80.0170.06314.14
5.3.70.0030.08014.25
5.3.60.0130.06714.13
5.3.50.0100.07014.01
5.3.40.0000.07014.02
5.3.30.0030.07713.91
5.3.20.0000.07713.72
5.3.10.0130.06013.69
5.3.00.0000.06713.77
5.2.170.0030.04013.32
5.2.160.0000.05313.32
5.2.150.0070.06013.32
5.2.140.0030.05313.32
5.2.130.0100.03013.32
5.2.120.0100.05013.32
5.2.110.0070.06013.32
5.2.100.0070.05713.32
5.2.90.0130.05013.32
5.2.80.0100.06013.32
5.2.70.0030.06313.32
5.2.60.0070.05313.32
5.2.50.0070.06013.32
5.2.40.0030.05313.32
5.2.30.0100.05013.32
5.2.20.0100.05313.32
5.2.10.0100.04713.32
5.2.00.0100.05313.32
5.1.60.0030.05713.32
5.1.50.0100.05013.32
5.1.40.0030.03713.32
5.1.30.0100.03313.32
5.1.20.0100.04713.32
5.1.10.0000.05713.32
5.1.00.0100.04713.32
5.0.50.0030.03713.32
5.0.40.0100.03713.32
5.0.30.0070.06013.32
5.0.20.0030.04013.32
5.0.10.0000.03013.32
5.0.00.0000.06313.32
4.4.90.0000.03313.32
4.4.80.0000.03313.32
4.4.70.0000.03713.32
4.4.60.0000.03713.32
4.4.50.0030.03313.32
4.4.40.0130.04013.32
4.4.30.0070.03013.32
4.4.20.0000.03713.32
4.4.10.0030.03013.32
4.4.00.0000.05713.32
4.3.110.0030.01713.32
4.3.100.0070.03013.32
4.3.90.0000.03713.32
4.3.80.0070.04713.32
4.3.70.0030.03313.32
4.3.60.0100.02313.32
4.3.50.0070.02313.32
4.3.40.0000.05013.32
4.3.30.0000.03013.32
4.3.20.0070.03013.32
4.3.10.0030.03313.32
4.3.00.0070.03013.32

preferences:
52.07 ms | 401 KiB | 5 Q