3v4l.org

run code in 300+ PHP versions simultaneously
<?php $message = "This is a string using the terms? Wait here's one\n abukuma kai\nabukuma-kai\nabukuma\nabukuma\nkai abukuma abukuma kai"; $search = array( 'abukuma kai', 'abukuma' ); $replacements = array( '<a href="http://kancolle.wikia.com/wiki/Abukuma#Upgrade" class="screenshot" rel="ship/Abukuma_Kai.png" style="color:#0073e6; font-weight:bold; border-bottom: 1px #0073e6 dashed;"><p id="yosup">Abukuma Kai</p></a>', '<a href="http://kancolle.wikia.com/wiki/Abukuma#Basic" class="screenshot" rel="ship/Abukuma.png" style="color:#0073e6; font-weight:bold; border-bottom: 1px #0073e6 dashed;">Abukuma</a>' ); function replaceStrings($haystack, $needle, $replacement, $offset = 0) { if (count($needle) != count($replacement)) { throw new \InvalidArgumentException('Needle length must match replacement length'); } $regexpDelimiter = '/'; $wordDelimiter = '[-\s_]'; if (is_array($needle)) { $massagedNeedles = array_map( function($s) use($regexpDelimiter, $wordDelimiter) { $s = preg_quote($s, $regexpDelimiter); $s = preg_replace('/' . $wordDelimiter . '/', $wordDelimiter, $s); return $s; }, $needle ); $regexp = implode('|', $massagedNeedes); } else { $regexp = preg_replace('/' . $wordDelimiter . '/', preg_quote($needle, '/')); } $regexp = sprintf('/%s/i', $regexp); $strpos = preg_match($regexp, $haystack, $matches, 0, $offset); if ($strpos === false) { return $haystack; } var_dump($matches); exit; return replaceStrings($haystack, $needle, $replacement, $offset); } replaceStrings($message, $search, $replacements);

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.0170.00018.18
8.3.50.0100.00521.26
8.3.40.0110.00419.09
8.3.30.0040.01120.17
8.3.20.0030.00520.33
8.3.10.0040.00421.92
8.3.00.0080.00022.39
8.2.180.0090.00617.00
8.2.170.0070.00722.96
8.2.160.0140.00422.36
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0000.00826.16
8.2.120.0040.00421.07
8.2.110.0100.00022.17
8.2.100.0080.00317.97
8.2.90.0040.00419.34
8.2.80.0030.00619.59
8.2.70.0030.00617.88
8.2.60.0080.00018.04
8.2.50.0050.00318.07
8.2.40.0000.00820.13
8.2.30.0070.00019.43
8.2.20.0030.00617.94
8.2.10.0030.00517.95
8.2.00.0090.00017.87
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0090.00023.98
8.1.230.0060.00619.06
8.1.220.0030.00617.89
8.1.210.0050.00318.77
8.1.200.0030.00617.60
8.1.190.0000.00817.65
8.1.180.0000.00819.01
8.1.170.0040.00418.91
8.1.160.0000.01018.95
8.1.150.0000.00818.84
8.1.140.0030.00517.66
8.1.130.0030.00317.91
8.1.120.0000.00817.71
8.1.110.0040.00417.61
8.1.100.0040.00417.54
8.1.90.0040.00417.55
8.1.80.0070.00017.65
8.1.70.0030.00317.56
8.1.60.0040.00417.77
8.1.50.0080.00017.61
8.1.40.0060.00317.57
8.1.30.0040.00417.72
8.1.20.0040.00417.88
8.1.10.0040.00417.80
8.1.00.0000.00717.75
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0070.00018.55
8.0.270.0000.00717.27
8.0.260.0040.00417.13
8.0.250.0000.00717.16
8.0.240.0040.00417.26
8.0.230.0030.00317.26
8.0.220.0000.00717.16
8.0.210.0040.00417.06
8.0.200.0000.00717.09
8.0.190.0040.00417.20
8.0.180.0030.00517.24
8.0.170.0000.00717.14
8.0.160.0040.00417.11
8.0.150.0070.00017.14
8.0.140.0000.00716.98
8.0.130.0030.00313.57
8.0.120.0050.00317.13
8.0.110.0020.00517.21
8.0.100.0000.00717.02
8.0.90.0040.00417.05
8.0.80.0140.00517.13
8.0.70.0040.00417.17
8.0.60.0040.00417.02
8.0.50.0000.00817.16
8.0.30.0140.00817.21
8.0.20.0120.01017.40
8.0.10.0080.00017.31
8.0.00.0090.00917.10
7.4.330.0050.00015.07
7.4.320.0060.00016.77
7.4.300.0000.00616.69
7.4.290.0040.00416.80
7.4.280.0000.00716.92
7.4.270.0030.00316.71
7.4.260.0000.00513.62
7.4.250.0040.00416.77
7.4.240.0050.00216.85
7.4.230.0040.00417.00
7.4.220.0120.01516.80
7.4.210.0060.01116.87
7.4.200.0000.00816.93
7.4.190.0000.00716.96
7.4.160.0100.00716.96
7.4.150.0170.00017.40
7.4.140.0080.01317.86
7.4.130.0130.00916.86
7.4.120.0100.00816.84
7.4.110.0070.01116.68
7.4.100.0040.01416.96
7.4.90.0100.00716.87
7.4.80.0040.01419.39
7.4.70.0120.00816.84
7.4.60.0110.00616.71
7.4.50.0050.00516.71
7.4.40.0110.00622.77
7.4.30.0070.01416.81
7.4.00.0060.01215.43
7.3.330.0000.00513.59
7.3.320.0050.00013.60
7.3.310.0050.00216.66
7.3.300.0080.00016.62
7.3.290.0070.00716.60
7.3.280.0040.01316.61
7.3.270.0070.01017.40
7.3.260.0130.00716.63
7.3.250.0150.00516.83
7.3.240.0030.01516.71
7.3.230.0030.01316.93
7.3.210.0150.00616.66
7.3.200.0120.00619.39
7.3.190.0120.00616.79
7.3.180.0100.00616.77
7.3.170.0060.01016.79
7.3.160.0060.01216.70
7.3.120.0070.01014.95
7.2.330.0100.00716.95
7.2.320.0090.00916.90
7.2.310.0090.00916.79
7.2.300.0090.01216.87
7.2.290.0100.00616.90
7.2.00.0030.00919.71
7.1.100.0000.00918.33
7.1.70.0050.00317.45
7.1.60.0030.01017.54
7.1.50.0090.01317.22
7.1.00.0030.06022.46
7.0.200.0030.00516.71
7.0.140.0030.07022.21
7.0.100.0200.06319.86
7.0.90.0130.08019.90
7.0.80.0130.07319.82
7.0.70.0070.08019.89
7.0.60.0270.08719.75
7.0.50.0070.07020.33
7.0.40.0100.07320.11
7.0.30.0100.06720.08
7.0.20.0100.08320.14
7.0.10.0170.06320.17
7.0.00.0030.07320.09
5.6.280.0070.07021.11
5.6.250.0100.07320.56
5.6.240.0130.08720.61
5.6.230.0070.07720.57
5.6.220.0070.08320.48
5.6.210.0100.08020.65
5.6.200.0130.07021.05
5.6.190.0070.08321.13
5.6.180.0100.07720.97
5.6.170.0130.08021.03
5.6.160.0130.04321.04
5.6.150.0030.09021.09
5.6.140.0100.03720.97
5.6.130.0000.08721.10
5.6.120.0070.08320.93
5.6.110.0100.08721.12
5.6.100.0100.04720.96
5.6.90.0070.07321.08
5.6.80.0100.07720.45
5.6.70.0070.08320.48
5.6.60.0030.04720.56
5.6.50.0100.07320.34
5.6.40.0170.04320.51
5.6.30.0000.07020.49
5.6.20.0030.08020.41
5.6.10.0030.05720.54
5.6.00.0070.08020.39
5.5.380.0070.08020.52
5.5.370.0070.08320.54
5.5.360.0100.06320.38
5.5.350.0030.08020.42
5.5.340.0070.08020.78
5.5.330.0100.04320.91
5.5.320.0200.07320.88
5.5.310.0100.04720.92
5.5.300.0030.07720.82
5.5.290.0100.07020.90
5.5.280.0000.08320.78
5.5.270.0070.08320.64
5.5.260.0030.07020.65
5.5.250.0070.08720.63
5.5.240.0030.05020.33
5.5.230.0030.06720.20
5.5.220.0170.06720.23
5.5.210.0070.07320.23
5.5.200.0070.06020.21
5.5.190.0030.06720.29
5.5.180.0070.06720.14
5.5.160.0030.07020.25
5.5.150.0170.07020.12
5.5.140.0070.08020.24
5.5.130.0230.05720.19
5.5.120.0070.06720.10
5.5.110.0200.06320.27
5.5.100.0130.06319.97
5.5.90.0070.04720.15
5.5.80.0100.06020.09
5.5.70.0030.07320.19
5.5.60.0130.08020.07
5.5.50.0030.04720.11
5.5.40.0100.07020.18
5.5.30.0070.05720.12
5.5.20.0100.04720.11
5.5.10.0030.06020.07
5.5.00.0070.05719.98
5.4.450.0030.04719.38
5.4.440.0130.07319.45
5.4.430.0030.06019.23
5.4.420.0100.06019.38
5.4.410.0070.07719.23
5.4.400.0070.07018.96
5.4.390.0030.05019.24
5.4.380.0130.07018.91
5.4.370.0070.08019.04
5.4.360.0130.06019.14
5.4.350.0130.06719.03
5.4.340.0070.07318.90
5.4.320.0030.07718.95
5.4.310.0000.04719.18
5.4.300.0070.07719.13
5.4.290.0000.08319.05
5.4.280.0130.07319.24
5.4.270.0130.06718.95
5.4.260.0030.08019.05
5.4.250.0070.07319.14
5.4.240.0130.06719.14
5.4.230.0030.05319.04
5.4.220.0070.08019.04
5.4.210.0000.08318.95
5.4.200.0130.07319.12
5.4.190.0130.06718.89
5.4.180.0100.06719.13
5.4.170.0070.07319.18
5.4.160.0070.06318.89
5.4.150.0070.07719.20
5.4.140.0030.04716.43
5.4.130.0070.06316.46
5.4.120.0100.07316.46
5.4.110.0030.07316.57
5.4.100.0070.03716.48
5.4.90.0070.03716.53
5.4.80.0030.03716.43
5.4.70.0000.03716.47
5.4.60.0070.04716.41
5.4.50.0070.03316.48
5.4.40.0030.03716.39
5.4.30.0000.03716.48
5.4.20.0000.03716.38
5.4.10.0070.03316.40
5.4.00.0100.02715.94
5.3.290.0030.05314.62
5.3.280.0030.04714.73
5.3.270.0030.07314.56
5.3.260.0000.08714.75
5.3.250.0070.06014.69
5.3.240.0030.07714.56
5.3.230.0030.08314.64
5.3.220.0070.07714.57
5.3.210.0070.06014.70
5.3.200.0070.07314.70
5.3.190.0030.03714.68
5.3.180.0070.03714.56
5.3.170.0070.04014.64
5.3.160.0030.04014.64
5.3.150.0030.03714.72
5.3.140.0070.03714.64
5.3.130.0000.04014.50
5.3.120.0070.04014.69
5.3.110.0030.03714.63
5.3.100.0030.06014.04
5.3.90.0070.04314.02
5.3.80.0100.02714.04
5.3.70.0100.06714.00
5.3.60.0030.04014.05
5.3.50.0030.03314.00
5.3.40.0030.05014.11
5.3.30.0030.07013.98
5.3.20.0000.04713.85
5.3.10.0000.03313.61
5.3.00.0000.03713.71
5.2.170.0100.06011.01
5.2.160.0030.06011.21
5.2.150.0030.04011.27
5.2.140.0000.03011.05
5.2.130.0070.02311.22
5.2.120.0000.03310.99
5.2.110.0070.02711.12
5.2.100.0030.02711.21
5.2.90.0070.06011.02
5.2.80.0000.03311.11
5.2.70.0070.05711.13
5.2.60.0070.04311.00
5.2.50.0030.02710.92
5.2.40.0030.04710.93
5.2.30.0000.04710.89
5.2.20.0100.03310.98
5.2.10.0000.03010.87
5.2.00.0070.04010.71
5.1.60.0000.02710.11
5.1.50.0030.02310.01
5.1.40.0000.0279.99
5.1.30.0000.02710.29
5.1.20.0000.02710.34
5.1.10.0030.02310.19
5.1.00.0000.02710.07
5.0.50.0030.0238.56
5.0.40.0000.0208.51
5.0.30.0030.0278.51
5.0.20.0030.0178.51
5.0.10.0000.0278.51
5.0.00.0000.0308.51
4.4.90.0000.0178.51
4.4.80.0030.0138.51
4.4.70.0030.0138.51
4.4.60.0030.0138.51
4.4.50.0000.0178.51
4.4.40.0000.0278.51
4.4.30.0000.0178.51
4.4.20.0000.0178.51
4.4.10.0000.0178.51
4.4.00.0000.0308.51
4.3.110.0000.0178.51
4.3.100.0000.0178.51
4.3.90.0000.0238.51
4.3.80.0000.0278.51
4.3.70.0000.0138.51
4.3.60.0000.0178.51
4.3.50.0030.0138.51
4.3.40.0000.0278.51
4.3.30.0000.0238.51
4.3.20.0000.0208.51
4.3.10.0030.0138.51
4.3.00.0000.0138.51

preferences:
46.79 ms | 401 KiB | 5 Q