3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<EOD The spread of a deadly new virus is accelerating, Chinese President Xi Jinping warned, after holding a special government meeting on the Lunar New Year public holiday. The country is facing a "grave situation" Mr Xi told senior officials. The coronavirus has killed at least 42 people and infected some 1,400 since its discovery in the city of Wuhan. Meanwhile, UK-based researchers have warned of a real possibility that China will not be able to contain the virus. Travel restrictions have come in place in several affected cities. From Sunday, private vehicles will be banned from central districts of Wuhan, the source of the outbreak. EOD; $words = explode(' ', $text); $concordance = 10; $results = array(); foreach (array_keys($words, 'in') as $idx) { $results[] = implode(' ', array_slice($words, max($idx - $concordance, 0), $concordance * 2 + 1)); } print_r($results); $words = explode(' ', $text); $concordance = 10; $results = array(); $last = 0; foreach (array_keys($words, 'in') as $idx) { if ($idx < $last) continue; $results[] = implode(' ', array_slice($words, max($idx - $concordance, 0), $concordance * 2 + 1)); $last = $idx + $concordance; } print_r($results);

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.0140.00418.43
8.3.60.0110.00716.88
8.3.50.0110.00416.58
8.3.40.0070.00718.65
8.3.30.0130.00618.80
8.3.20.0040.00423.51
8.3.10.0060.00321.96
8.3.00.0040.00421.91
8.2.190.0070.00716.58
8.2.180.0060.00925.92
8.2.170.0070.00718.91
8.2.160.0030.01020.53
8.2.150.0070.00724.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00226.16
8.2.110.0060.00320.47
8.2.100.0060.00617.91
8.2.90.0080.00018.34
8.2.80.0000.00818.16
8.2.70.0000.00817.63
8.2.60.0060.00317.50
8.2.50.0080.00018.05
8.2.40.0030.00617.98
8.2.30.0040.00419.38
8.2.20.0000.00818.04
8.2.10.0040.00419.27
8.2.00.0000.00719.30
8.1.280.0160.00625.92
8.1.270.0040.00421.98
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0070.01023.73
8.1.230.0120.00022.74
8.1.220.0080.00017.77
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0030.00617.11
8.1.180.0040.00418.10
8.1.170.0000.00817.62
8.1.160.0040.00418.82
8.1.150.0040.00419.01
8.1.140.0070.00020.66
8.1.130.0030.00320.29
8.1.120.0030.00317.40
8.1.110.0030.00517.53
8.1.100.0000.00717.54
8.1.90.0030.00317.50
8.1.80.0040.00417.48
8.1.70.0000.00717.30
8.1.60.0040.00417.61
8.1.50.0060.00317.54
8.1.40.0040.00417.44
8.1.30.0040.00417.66
8.1.20.0030.00617.57
8.1.10.0040.00417.58
8.1.00.0080.00017.50
8.0.300.0000.00820.07
8.0.290.0000.00816.63
8.0.280.0080.00018.54
8.0.270.0070.00018.10
8.0.260.0040.00419.97
8.0.250.0000.00717.05
8.0.240.0000.00716.96
8.0.230.0000.00717.08
8.0.220.0030.00316.92
8.0.210.0060.00016.87
8.0.200.0030.00317.04
8.0.190.0030.00317.04
8.0.180.0090.00016.99
8.0.170.0060.00317.01
8.0.160.0030.00317.04
8.0.150.0000.00716.87
8.0.140.0080.00016.80
8.0.130.0030.00313.38
8.0.120.0070.00016.85
8.0.110.0030.00316.95
8.0.100.0050.00217.02
8.0.90.0030.00617.04
8.0.80.0080.00816.94
8.0.70.0000.00716.89
8.0.60.0050.00316.86
8.0.50.0000.00716.98
8.0.30.0060.00916.96
8.0.20.0060.01317.10
8.0.10.0040.00416.96
8.0.00.0110.00716.80
7.4.330.0000.00616.84
7.4.320.0000.00716.52
7.4.300.0040.00416.45
7.4.290.0000.00816.59
7.4.280.0030.00516.43
7.4.270.0000.00716.54
7.4.260.0050.00013.25
7.4.250.0050.00216.59
7.4.240.0040.00416.49
7.4.230.0000.00816.55
7.4.220.0070.00016.56
7.4.210.0070.01016.56
7.4.200.0000.00716.72
7.4.130.0140.01016.71
7.4.120.0090.01116.69
7.4.110.0090.00916.32
7.4.100.0140.00616.55
7.4.90.0140.00316.53
7.4.80.0030.01719.39
7.4.70.0090.00916.59
7.4.60.0130.01016.57
7.4.50.0070.01116.34
7.4.40.0070.01016.63
7.4.20.0120.00916.54
7.4.10.0030.01316.47
7.4.00.0040.01116.64
7.3.330.0060.00316.41
7.3.320.0060.00013.20
7.3.310.0070.00016.29
7.3.300.0000.00616.31
7.3.290.0080.00516.36
7.3.260.0030.01316.52
7.3.240.0080.01116.45
7.3.230.0060.01016.30
7.3.210.0090.00916.37
7.3.200.0120.01616.55
7.3.190.0190.00316.47
7.3.180.0060.01116.27
7.3.170.0160.00416.46
7.3.160.0100.01316.49
7.3.130.0090.00616.52
7.3.120.0120.00316.29
7.3.110.0030.01116.47
7.3.100.0090.00616.27
7.3.90.0160.00016.27
7.3.80.0040.01516.24
7.3.70.0000.01716.31
7.3.60.0040.01616.21
7.3.50.0130.00816.32
7.3.40.0120.00916.37
7.3.30.0130.00316.39
7.3.20.0120.00916.52
7.3.10.0090.00916.49
7.3.00.0600.01616.49
7.2.330.0130.00316.78
7.2.320.0130.00316.45
7.2.310.0110.00516.81
7.2.300.0060.01616.80
7.2.290.0110.01116.73
7.2.260.0070.01016.61
7.2.250.0120.00316.46
7.2.240.0120.00316.53
7.2.230.0120.00316.52
7.2.220.0090.01116.79
7.2.210.0120.01016.38
7.2.200.0060.01916.50
7.2.190.0050.01416.51
7.2.180.0140.00916.61
7.2.170.0070.01116.64
7.2.160.0100.01616.59
7.2.150.0100.00716.64
7.2.140.0040.01416.75
7.2.130.0110.00416.55
7.2.120.0140.00316.54
7.2.110.0080.01216.45
7.2.100.0140.00516.50
7.2.90.0060.01316.53
7.2.80.0040.01116.60
7.2.70.0110.00916.52
7.2.60.0130.00316.58
7.2.50.0100.00716.66
7.2.40.0070.01016.64
7.2.30.0060.00916.69
7.2.20.0110.00616.59
7.2.10.0100.00716.74
7.2.00.0050.01116.73

preferences:
16.41 ms | 401 KiB | 5 Q