3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = ['word', 'chord', 'tech', 'care', 'kek', 'lol', 'wild', 'regex']; $arr2 = ['ord', 'ek', 'ol', 'ld', 'gex', 'ss']; $keys=[]; foreach($arr2 as $val){ $matches = preg_grep("/.+" . preg_quote($val) . "/", $arr1); $keys = array_merge($keys, array_keys($matches)); // save keys of matched words foreach($matches as $key => $m) $new[$val][] = str_replace($val, "_$val", $arr1[$key]); } $new['unmatched'] = array_diff_key($arr1, array_flip($keys)); // add unmatched words var_dump($new);

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.60.0100.01318.43
8.3.50.0090.00618.19
8.3.40.0110.00418.88
8.3.30.0040.01118.92
8.3.20.0080.00019.32
8.3.10.0100.00021.90
8.3.00.0030.00523.57
8.2.180.0140.00716.75
8.2.170.0070.01522.96
8.2.160.0140.00020.10
8.2.150.0000.01124.18
8.2.140.0080.00024.66
8.2.130.0000.00822.38
8.2.120.0080.00026.35
8.2.110.0040.00420.28
8.2.100.0070.00717.84
8.2.90.0030.00517.88
8.2.80.0030.00617.97
8.2.70.0000.00817.92
8.2.60.0030.00618.05
8.2.50.0060.00318.10
8.2.40.0000.00819.24
8.2.30.0000.00720.74
8.2.20.0070.00018.02
8.2.10.0070.00018.04
8.2.00.0000.00719.53
8.1.280.0140.00625.92
8.1.270.0160.00321.93
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0080.00421.95
8.1.230.0060.00622.62
8.1.220.0000.00817.89
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0040.00417.38
8.1.180.0000.00918.10
8.1.170.0040.00418.84
8.1.160.0040.00418.77
8.1.150.0050.00318.97
8.1.140.0030.00319.03
8.1.130.0030.00318.98
8.1.120.0000.00817.60
8.1.110.0030.00617.54
8.1.100.0050.00317.57
8.1.90.0030.00717.60
8.1.80.0000.00717.55
8.1.70.0000.00717.57
8.1.60.0000.00817.74
8.1.50.0080.00017.67
8.1.40.0030.00517.66
8.1.30.0050.00317.63
8.1.20.0030.00717.65
8.1.10.0000.01117.71
8.1.00.0040.00417.54
8.0.300.0070.00018.77
8.0.290.0070.00016.75
8.0.280.0070.00018.45
8.0.270.0060.00317.27
8.0.260.0030.00317.21
8.0.250.0030.00617.07
8.0.240.0030.00316.96
8.0.230.0070.00017.10
8.0.220.0030.00516.96
8.0.210.0000.00717.10
8.0.200.0000.00617.13
8.0.190.0030.00616.98
8.0.180.0040.00416.96
8.0.170.0000.00917.13
8.0.160.0080.00016.95
8.0.150.0030.00617.03
8.0.140.0030.00516.99
8.0.130.0030.00313.41
8.0.120.0040.00416.90
8.0.110.0050.00316.95
8.0.100.0000.00717.02
8.0.90.0070.00016.95
8.0.80.0070.01217.03
8.0.70.0000.00716.92
8.0.60.0050.00216.99
8.0.50.0000.00717.01
8.0.30.0110.00717.23
8.0.20.0110.01517.40
8.0.10.0040.00417.01
8.0.00.0170.00616.89
7.4.330.0020.00215.55
7.4.320.0000.00616.81
7.4.300.0000.00716.70
7.4.290.0070.00416.77
7.4.280.0050.00516.72
7.4.270.0030.00316.79
7.4.260.0000.00716.78
7.4.250.0000.00816.81
7.4.240.0050.00316.57
7.4.230.0080.00016.61
7.4.220.0080.00016.80
7.4.210.0070.01116.65
7.4.200.0060.00316.62
7.4.160.0100.00616.81
7.4.140.0120.00717.86
7.4.130.0090.00916.66
7.4.120.0140.00716.73
7.4.110.0180.00016.48
7.4.100.0180.00016.76
7.4.90.0130.00716.73
7.4.80.0170.00719.39
7.4.70.0090.01216.79
7.4.60.0100.00716.72
7.4.50.0030.01316.84
7.4.40.0110.01516.65
7.4.00.0040.01315.15
7.3.330.0000.00613.17
7.3.320.0030.00313.28
7.3.310.0040.00316.54
7.3.300.0000.00616.37
7.3.290.0030.00316.31
7.3.280.0070.01116.47
7.3.260.0070.01216.59
7.3.240.0090.01116.65
7.3.230.0060.01216.46
7.3.210.0150.00416.75
7.3.200.0160.00616.51
7.3.190.0070.01016.64
7.3.180.0130.00716.74
7.3.170.0100.00616.46
7.3.160.0140.00316.68
7.3.120.0040.01414.80
7.3.110.0160.00014.68
7.3.100.0120.00314.84
7.3.90.0030.01115.04
7.3.80.0110.00415.19
7.3.70.0130.00014.68
7.3.60.0030.01015.13
7.3.50.0030.00914.74
7.3.40.0030.00814.96
7.3.30.0040.00414.88
7.3.20.0140.00016.91
7.3.10.0040.00816.60
7.3.00.0060.00616.75
7.2.330.0040.01516.63
7.2.320.0160.00316.84
7.2.310.0140.01016.90
7.2.300.0090.00616.94
7.2.290.0160.00316.83
7.2.250.0160.00315.34
7.2.240.0040.01415.31
7.2.230.0070.00415.05
7.2.220.0030.01315.36
7.2.210.0070.00715.34
7.2.200.0000.01615.06
7.2.190.0000.00915.05
7.2.180.0060.00915.25
7.2.170.0060.00915.12
7.2.80.0770.00014.94
7.2.70.0460.00015.09
7.2.60.0510.01315.29
7.2.50.0700.00315.31
7.2.40.0440.01015.43
7.2.30.0360.01315.05
7.2.20.0570.00315.30
7.2.10.0390.00615.18
7.2.00.0380.00614.86
7.1.330.0100.00315.84
7.1.320.0030.01216.02
7.1.310.0110.00416.13
7.1.300.0060.00615.93
7.1.290.0070.00716.05
7.1.280.0000.01616.06
7.1.270.0100.00315.95
7.1.260.0000.01015.96
7.1.200.0630.00713.91
7.1.190.0300.00713.75
7.1.180.0650.00314.03
7.1.170.0390.01013.82
7.1.160.0420.00313.80
7.1.150.0410.01014.16
7.1.140.0700.01314.17
7.1.130.0420.00914.05
7.1.120.0450.00013.84
7.1.110.1250.00313.91
7.1.100.0480.00713.83
7.1.90.0510.01114.09
7.1.80.0640.01114.29
7.1.70.0380.00014.31
7.1.60.0570.00931.86
7.1.50.0450.00632.11
7.1.40.0570.00332.13
7.1.30.0530.00732.10
7.1.20.0500.00731.88
7.1.10.0040.00813.82
7.1.00.0060.00613.75

preferences:
58.36 ms | 400 KiB | 5 Q