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( // here all replaces | each in a new line - watch the syntax // all html possible, but no single quotation mark! '<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) { $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); }

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.0070.01018.18
8.3.50.0150.00321.14
8.3.40.0090.00618.54
8.3.30.0100.00320.31
8.3.20.0070.00020.21
8.3.10.0040.00422.09
8.3.00.0070.00022.44
8.2.180.0170.00316.35
8.2.170.0140.00722.96
8.2.160.0070.00722.12
8.2.150.0000.00924.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00420.66
8.2.110.0040.00820.23
8.2.100.0040.00817.78
8.2.90.0000.00819.14
8.2.80.0040.00419.33
8.2.70.0050.00317.63
8.2.60.0030.00517.80
8.2.50.0050.00318.07
8.2.40.0000.00819.88
8.2.30.0040.00419.48
8.2.20.0040.00417.69
8.2.10.0080.00017.57
8.2.00.0030.00617.61
8.1.280.0110.00425.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0030.00623.74
8.1.230.0040.00820.88
8.1.220.0070.00317.74
8.1.210.0000.00918.77
8.1.200.0000.01217.35
8.1.190.0000.00817.41
8.1.180.0080.00019.01
8.1.170.0050.00318.51
8.1.160.0070.00318.87
8.1.150.0040.00418.72
8.1.140.0000.00817.46
8.1.130.0030.00317.85
8.1.120.0040.00417.43
8.1.110.0050.00317.44
8.1.100.0040.00417.31
8.1.90.0030.00417.47
8.1.80.0080.00017.33
8.1.70.0000.00717.39
8.1.60.0030.00517.44
8.1.50.0000.00717.41
8.1.40.0050.00517.39
8.1.30.0000.00817.57
8.1.20.0030.00517.52
8.1.10.0000.00817.48
8.1.00.0000.00717.25
8.0.300.0000.00718.77
8.0.290.0000.00716.93
8.0.280.0040.00418.38
8.0.270.0070.00017.23
8.0.260.0040.00416.82
8.0.250.0070.00016.85
8.0.240.0030.00616.91
8.0.230.0070.00016.89
8.0.220.0080.00016.76
8.0.210.0050.00316.86
8.0.200.0030.00316.95
8.0.190.0050.00316.80
8.0.180.0000.00816.76
8.0.170.0000.00716.87
8.0.160.0030.00316.74
8.0.150.0000.00716.76
8.0.140.0080.00016.81
8.0.130.0030.00313.26
8.0.120.0040.00416.86
8.0.110.0000.00716.70
8.0.100.0000.00716.70
8.0.90.0040.00316.76
8.0.80.0090.00616.82
8.0.70.0040.00416.84
8.0.60.0000.00816.90
8.0.50.0050.00316.77
8.0.30.0120.01016.96
8.0.20.0130.00517.40
8.0.10.0040.00416.95
8.0.00.0090.00916.69
7.4.330.0050.00015.14
7.4.320.0000.00616.47
7.4.300.0000.00616.40
7.4.290.0000.00716.62
7.4.280.0040.00316.49
7.4.270.0000.00716.47
7.4.260.0080.00013.23
7.4.250.0030.00316.54
7.4.240.0020.00516.52
7.4.230.0080.00016.46
7.4.220.0110.00716.69
7.4.210.0040.01116.54
7.4.200.0000.00816.60
7.4.190.0000.00716.43
7.4.160.0110.00416.48
7.4.150.0140.00317.40
7.4.140.0140.00817.86
7.4.130.0100.01116.45
7.4.120.0080.01016.32
7.4.110.0070.01016.45
7.4.100.0070.01016.30
7.4.90.0070.01016.48
7.4.80.0070.01319.39
7.4.70.0120.00316.40
7.4.60.0090.00616.34
7.4.50.0030.00516.40
7.4.40.0140.00022.77
7.4.30.0130.00316.39
7.4.00.0070.01014.68
7.3.330.0000.00513.20
7.3.320.0000.00513.22
7.3.310.0040.00416.19
7.3.300.0020.00515.99
7.3.290.0110.00316.18
7.3.280.0060.01216.18
7.3.270.0130.00317.40
7.3.260.0160.00316.44
7.3.250.0130.00516.47
7.3.240.0030.01316.24
7.3.230.0090.00916.39
7.3.210.0100.01016.21
7.3.200.0030.01416.11
7.3.190.0100.00616.55
7.3.180.0080.00716.27
7.3.170.0120.00416.27
7.3.160.0070.01216.26
7.3.120.0070.01014.37
7.2.330.0070.01016.57
7.2.320.0090.00616.28
7.2.310.0140.01016.51
7.2.300.0060.00916.33
7.2.290.0160.00016.37
7.2.00.0060.00619.13
7.1.100.0030.01217.78
7.1.70.0070.00316.94
7.1.60.0030.01016.87
7.1.50.0100.01316.91
7.1.00.0030.06722.54
7.0.200.0040.00416.67
7.0.140.0100.07022.00
7.0.100.0070.03719.91
7.0.90.0270.05719.98
7.0.80.0030.06019.87
7.0.70.0300.07319.95
7.0.60.0100.04019.80
7.0.50.0070.10020.18
7.0.40.0070.08020.07
7.0.30.0000.09320.13
7.0.20.0030.04320.18
7.0.10.0130.03320.14
7.0.00.0070.04019.95
5.6.280.0000.07720.79
5.6.250.0000.07320.73
5.6.240.0030.04320.62
5.6.230.0030.09320.69
5.6.220.0030.07320.68
5.6.210.0030.04320.57
5.6.200.0070.08720.96
5.6.190.0100.06321.02
5.6.180.0070.03721.05
5.6.170.0070.04021.03
5.6.160.0070.04021.02
5.6.150.0030.04321.03
5.6.140.0030.04721.09
5.6.130.0030.04321.10
5.6.120.0000.05021.02
5.6.110.0030.04720.96
5.6.100.0070.04320.99
5.6.90.0100.04021.03
5.6.80.0030.06720.34
5.6.70.0070.03320.41
5.6.60.0100.04020.44
5.6.50.0000.04320.48
5.6.40.0030.04020.44
5.6.30.0070.04020.41
5.6.20.0100.04020.42
5.6.10.0000.04320.42
5.6.00.0030.03320.43
5.5.380.0000.04720.37
5.5.370.0100.07020.45
5.5.360.0030.07720.37
5.5.350.0030.05320.40
5.5.340.0030.07020.79
5.5.330.0030.08720.79
5.5.320.0000.07720.92
5.5.310.0130.05720.93
5.5.300.0070.05320.89
5.5.290.0070.04320.91
5.5.280.0100.03020.93
5.5.270.0070.03720.64
5.5.260.0000.04720.75
5.5.250.0030.06320.75
5.5.240.0070.03720.27
5.5.230.0070.04020.18
5.5.220.0030.04020.29
5.5.210.0070.03720.15
5.5.200.0030.04020.29
5.5.190.0070.04019.96
5.5.180.0070.03020.23
5.5.160.0030.04020.19
5.5.150.0070.04020.21
5.5.140.0000.04020.13
5.5.130.0070.02720.25
5.5.120.0030.03320.25
5.5.110.0030.03720.19
5.5.100.0100.03020.09
5.5.90.0000.04019.98
5.5.80.0100.04020.17
5.5.70.0070.03319.95
5.5.60.0070.05320.01
5.5.50.0070.08020.11
5.5.40.0130.07020.04
5.5.30.0070.04020.15
5.5.20.0070.08020.12
5.5.10.0000.06720.03
5.5.00.0100.06020.04
5.4.450.0100.03719.54
5.4.440.0100.03719.38
5.4.430.0030.04019.35
5.4.420.0000.04319.46
5.4.410.0030.04019.43
5.4.400.0000.04718.95
5.4.390.0070.03318.95
5.4.380.0030.03319.15
5.4.370.0030.03319.03
5.4.360.0100.03319.21
5.4.350.0130.02719.03
5.4.340.0000.03719.14
5.4.320.0030.04019.16
5.4.310.0030.03018.88
5.4.300.0000.05718.84
5.4.290.0030.03019.12
5.4.280.0000.03719.05
5.4.270.0000.03319.23
5.4.260.0070.03019.18
5.4.250.0070.03318.87
5.4.240.0070.04319.17
5.4.230.0000.04018.84
5.4.220.0100.03018.93
5.4.210.0070.06718.86
5.4.200.0130.02719.09
5.4.190.0100.03719.03
5.4.180.0070.08319.12
5.4.170.0070.06019.08
5.4.160.0130.05319.11
5.4.150.0100.08019.16
5.4.140.0070.06016.50
5.4.130.0070.07316.52
5.4.120.0030.05016.38
5.4.110.0030.08016.38
5.4.100.0000.07716.41
5.4.90.0130.06316.49
5.4.80.0130.04016.47
5.4.70.0000.07716.50
5.4.60.0100.05316.47
5.4.50.0030.07716.39
5.4.40.0130.07316.45
5.4.30.0100.07016.47
5.4.20.0000.07016.45
5.4.10.0070.03716.41
5.4.00.0030.04315.63
5.3.290.0000.04714.73
5.3.280.0070.07314.71
5.3.270.0070.08014.62
5.3.260.0230.03314.71
5.3.250.0070.07314.62
5.3.240.0030.04314.67
5.3.230.0100.07014.55
5.3.220.0000.04014.59
5.3.210.0070.04314.54
5.3.200.0070.07714.63
5.3.190.0030.05714.59
5.3.180.0100.07314.50
5.3.170.0070.07314.63
5.3.160.0070.03714.69
5.3.150.0100.03714.55
5.3.140.0030.06014.62
5.3.130.0100.07714.58
5.3.120.0100.03714.69
5.3.110.0030.08714.51
5.3.100.0070.06714.16
5.3.90.0030.04314.11
5.3.80.0100.04314.09
5.3.70.0070.08314.16
5.3.60.0130.06714.12
5.3.50.0070.04013.98
5.3.40.0130.05014.01
5.3.30.0030.03714.02
5.3.20.0070.03713.68
5.3.10.0070.03313.57
5.3.00.0100.04713.71
5.2.170.0000.04012.36
5.2.160.0030.03012.36
5.2.150.0030.03712.36
5.2.140.0030.05312.36
5.2.130.0030.03012.36
5.2.120.0000.03312.36
5.2.110.0070.05312.36
5.2.100.0100.03312.36
5.2.90.0130.04312.36
5.2.80.0030.04712.36
5.2.70.0030.03312.36
5.2.60.0100.02712.36
5.2.50.0030.06312.36
5.2.40.0100.05312.36
5.2.30.0100.05712.36
5.2.20.0000.05712.36
5.2.10.0030.04312.36
5.2.00.0000.03312.36
5.1.60.0000.03012.36
5.1.50.0000.03012.36
5.1.40.0070.04712.36
5.1.30.0030.02712.36
5.1.20.0000.05712.36
5.1.10.0030.04012.36
5.1.00.0000.03012.36
5.0.50.0000.04312.36
5.0.40.0070.04012.36
5.0.30.0000.03312.36
5.0.20.0070.04012.36
5.0.10.0000.04712.36
5.0.00.0000.05712.36
4.4.90.0030.01712.36
4.4.80.0030.03012.36
4.4.70.0030.02012.36
4.4.60.0000.03712.36
4.4.50.0030.01312.36
4.4.40.0030.05312.36
4.4.30.0000.03712.36
4.4.20.0030.01712.36
4.4.10.0000.03012.36
4.4.00.0030.05312.36
4.3.110.0070.02312.36
4.3.100.0000.02012.36
4.3.90.0000.03012.36
4.3.80.0000.03012.36
4.3.70.0030.02712.36
4.3.60.0030.02012.36
4.3.50.0030.03312.36
4.3.40.0000.04312.36
4.3.30.0000.03712.36
4.3.20.0000.03712.36
4.3.10.0000.04312.36
4.3.00.0030.02312.36

preferences:
37.93 ms | 401 KiB | 5 Q