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) { 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, $replace);

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.0090.00618.43
8.3.50.0090.00722.05
8.3.40.0110.00718.85
8.3.30.0140.00019.13
8.3.20.0000.00820.22
8.3.10.0050.00323.66
8.3.00.0050.00322.52
8.2.180.0040.01116.75
8.2.170.0110.00422.96
8.2.160.0130.00020.39
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0170.00326.16
8.2.120.0070.00022.13
8.2.110.0060.00322.25
8.2.100.0030.00717.78
8.2.90.0000.00819.09
8.2.80.0090.00017.97
8.2.70.0070.00417.75
8.2.60.0030.00517.65
8.2.50.0030.00518.07
8.2.40.0000.00818.16
8.2.30.0070.00718.01
8.2.20.0040.00417.66
8.2.10.0050.00317.75
8.2.00.0000.00717.84
8.1.280.0070.00725.92
8.1.270.0040.00422.06
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00323.82
8.1.230.0070.00419.14
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0060.00317.36
8.1.190.0000.00817.68
8.1.180.0080.00018.10
8.1.170.0060.00318.56
8.1.160.0040.00422.08
8.1.150.0000.00818.66
8.1.140.0040.00417.46
8.1.130.0030.00317.90
8.1.120.0040.00317.50
8.1.110.0040.00417.44
8.1.100.0000.00717.37
8.1.90.0070.00017.48
8.1.80.0070.00017.53
8.1.70.0030.00517.46
8.1.60.0080.00017.64
8.1.50.0040.00417.46
8.1.40.0000.00817.54
8.1.30.0000.00917.62
8.1.20.0040.00417.67
8.1.10.0030.00617.51
8.1.00.0040.00417.58
8.0.300.0030.00318.77
8.0.290.0080.00017.05
8.0.280.0000.00718.49
8.0.270.0000.00817.12
8.0.260.0000.00716.86
8.0.250.0040.00416.97
8.0.240.0050.00317.02
8.0.230.0030.00316.94
8.0.220.0020.00516.96
8.0.210.0030.00316.91
8.0.200.0040.00416.95
8.0.190.0000.00717.02
8.0.180.0060.00316.93
8.0.170.0080.00016.91
8.0.160.0000.00716.96
8.0.150.0000.00716.91
8.0.140.0040.00416.98
8.0.130.0000.00613.42
8.0.120.0030.00516.85
8.0.110.0040.00316.95
8.0.100.0000.00817.02
8.0.90.0040.00416.96
8.0.80.0060.00916.92
8.0.70.0040.00417.11
8.0.60.0070.00016.79
8.0.50.0040.00416.95
8.0.30.0110.00816.97
8.0.20.0090.01117.40
8.0.10.0040.00417.03
8.0.00.0080.01116.71
7.4.330.0050.00015.08
7.4.320.0060.00016.65
7.4.300.0030.00316.64
7.4.290.0030.00316.65
7.4.280.0030.00616.54
7.4.270.0040.00416.65
7.4.260.0030.00316.58
7.4.250.0040.00416.52
7.4.240.0040.00416.57
7.4.230.0030.00316.66
7.4.220.0120.00616.71
7.4.210.0070.00816.58
7.4.200.0030.00316.36
7.4.190.0000.00816.50
7.4.160.0030.01316.54
7.4.150.0100.01717.40
7.4.140.0030.01417.86
7.4.130.0050.01316.64
7.4.120.0120.00516.53
7.4.110.0120.00916.50
7.4.100.0120.00616.69
7.4.90.0070.01016.67
7.4.80.0060.01119.39
7.4.70.0090.00816.55
7.4.60.0070.01016.63
7.4.50.0030.00616.41
7.4.40.0040.01122.77
7.4.30.0130.00316.48
7.4.10.0070.01314.95
7.4.00.0080.00715.13
7.3.330.0050.00013.47
7.3.320.0050.00013.32
7.3.310.0030.00316.26
7.3.300.0040.00416.25
7.3.290.0060.01016.38
7.3.280.0090.00916.37
7.3.270.0090.00917.40
7.3.260.0070.01716.70
7.3.250.0140.00316.54
7.3.240.0120.00616.52
7.3.230.0090.01316.57
7.3.210.0170.00016.64
7.3.200.0100.00619.39
7.3.190.0120.00916.41
7.3.180.0130.00316.53
7.3.170.0090.00616.47
7.3.160.0080.00816.48
7.3.130.0100.00614.77
7.3.120.0040.01214.96
7.3.110.0070.01314.97
7.3.100.0030.01314.84
7.3.90.0070.00714.68
7.3.80.0000.00914.98
7.3.70.0000.01015.04
7.3.60.0000.01414.98
7.3.50.0000.01514.86
7.3.40.0090.00614.57
7.3.30.0030.00614.93
7.3.20.0100.00016.80
7.3.10.0070.00716.70
7.3.00.0040.01116.75
7.2.330.0140.00316.43
7.2.320.0080.01116.41
7.2.310.0100.01316.74
7.2.300.0090.01116.48
7.2.290.0100.00716.49
7.2.260.0060.01314.95
7.2.250.0160.00315.20
7.2.240.0030.01214.96
7.2.230.0090.00314.73
7.2.220.0060.01314.99
7.2.210.0090.00314.77
7.2.200.0030.00914.84
7.2.190.0040.01215.02
7.2.180.0120.00314.80
7.2.170.0090.00615.05
7.2.160.0040.01114.87
7.2.150.0030.01416.93
7.2.140.0000.01416.95
7.2.130.0070.00716.87
7.2.120.0030.00616.85
7.2.110.0090.00616.77
7.2.100.0090.00617.00
7.2.90.0080.00416.92
7.2.80.0030.01016.93
7.2.70.0110.00416.75
7.2.60.0060.00716.89
7.2.50.0040.01116.96
7.2.40.0060.00917.05
7.2.30.0030.00616.94
7.2.20.0040.01116.86
7.2.10.0100.00716.63
7.2.00.0000.01116.82
7.1.330.0080.00615.64
7.1.320.0090.00615.54
7.1.310.0000.01215.46
7.1.300.0040.01115.74
7.1.290.0120.00315.75
7.1.280.0100.00315.93
7.1.270.0090.00615.70
7.1.260.0090.00615.73
7.1.250.0030.00715.47
7.1.240.0090.00615.44
7.1.230.0060.00315.91
7.1.220.0090.00615.87
7.1.210.0100.00315.85
7.1.200.0040.00915.87
7.1.190.0030.00915.74
7.1.180.0070.00315.39
7.1.170.0090.00015.71
7.1.160.0120.00615.81
7.1.150.0040.00515.60
7.1.140.0100.00315.62
7.1.130.0030.01215.83
7.1.120.0060.00315.44
7.1.110.0070.00315.64
7.1.100.0040.00715.80
7.1.90.0090.00915.61
7.1.80.0070.01015.66
7.1.70.0030.00916.38
7.1.60.0030.01617.38
7.1.50.0110.01425.34
7.1.40.0070.00715.72
7.1.30.0100.01015.71
7.1.20.0060.00915.72
7.1.10.0070.00715.75
7.1.00.0020.04419.00
7.0.330.0100.00015.53
7.0.320.0090.00315.46
7.0.310.0030.00915.43
7.0.300.0060.01015.61
7.0.290.0090.00415.10
7.0.280.0040.00415.45
7.0.270.0040.00415.14
7.0.260.0030.00715.31
7.0.250.0080.00415.31
7.0.240.0070.00715.17
7.0.230.0060.01015.15
7.0.220.0090.00415.38
7.0.210.0070.00315.55
7.0.200.0010.00816.01
7.0.190.0080.00615.27
7.0.180.0130.00615.25
7.0.170.0120.00615.36
7.0.160.0030.00715.48
7.0.150.0110.00415.23
7.0.140.0020.04418.56
7.0.130.0030.00615.11
7.0.120.0070.00715.37
7.0.110.0040.01115.47
7.0.100.0090.00615.13
7.0.90.0060.00615.28
7.0.80.0090.00315.62
7.0.70.0000.01415.52
7.0.60.0090.02117.59
7.0.50.0080.02316.68
7.0.40.0070.02916.86
7.0.30.0200.03816.82
7.0.20.0200.01516.79
7.0.10.0100.04516.71
7.0.00.0030.03016.76
5.6.400.0030.01214.35
5.6.390.0060.00614.42
5.6.380.0070.00314.53
5.6.370.0100.00614.34
5.6.360.0050.00514.29
5.6.350.0070.00714.41
5.6.340.0060.00614.43
5.6.330.0090.00614.55
5.6.320.0080.00313.99
5.6.310.0040.00814.54
5.6.300.0100.00714.48
5.6.290.0110.00414.31
5.6.280.0070.03817.74
5.6.270.0060.00614.50
5.6.260.0110.00014.40
5.6.250.0110.00414.34
5.6.240.0000.01414.37
5.6.230.0030.00914.17
5.6.220.0040.01214.22
5.6.210.0060.03117.66
5.6.200.0080.04316.37
5.6.190.0060.04117.37
5.6.180.0140.02917.45
5.6.170.0160.02317.34
5.6.160.0050.05017.38
5.6.150.0080.02616.30
5.6.140.0050.04516.26
5.6.130.0080.04516.28
5.6.120.0050.04317.69
5.6.110.0050.02417.67
5.6.100.0100.04217.73
5.6.90.0140.04217.61
5.6.80.0080.04017.33
5.6.70.0060.01214.31
5.6.60.0070.00714.30
5.6.50.0080.00414.28
5.6.40.0030.01314.04
5.6.30.0060.00614.36
5.6.20.0040.01514.04
5.6.10.0060.00314.34
5.6.00.0000.00814.43
5.5.380.0120.00314.41
5.5.370.0050.00514.44
5.5.360.0110.00714.43
5.5.350.0070.02817.30
5.5.340.0030.04115.98
5.5.330.0020.04617.47
5.5.320.0070.04217.40
5.5.310.0180.03717.20
5.5.300.0020.04815.97
5.5.290.0020.04116.22
5.5.280.0070.04517.66
5.5.270.0030.03317.62
5.5.260.0110.04017.39
5.5.250.0080.03017.58
5.5.240.2150.02017.04
5.5.230.0070.00714.11
5.5.220.0000.01514.11
5.5.210.0040.00714.00
5.5.200.0000.01214.08
5.5.190.0110.00314.16
5.5.180.0040.01514.42
5.5.170.0060.00914.27
5.5.160.0100.00713.93
5.5.150.0060.00914.36
5.5.140.0080.00014.47
5.5.130.0000.00914.45
5.5.120.0070.00714.07
5.5.110.0060.00914.52
5.5.100.0060.00914.05
5.5.90.0090.00614.07
5.5.80.0000.01414.40
5.5.70.0040.00814.29
5.5.60.0060.00614.02
5.5.50.0100.00714.55
5.5.40.0040.01413.83
5.5.30.0060.00914.23
5.5.20.0070.00314.20
5.5.10.0030.01013.90
5.5.00.0030.00914.37
5.4.450.0420.02515.22
5.4.440.0430.03115.14
5.4.430.0450.03015.29
5.4.420.0470.03515.22
5.4.410.0430.04615.10
5.4.400.0370.03015.09
5.4.390.0180.03015.13
5.4.380.0040.03314.92
5.4.370.0090.02914.91
5.4.360.0080.02914.69
5.4.350.0160.02514.79
5.4.340.0050.03214.64
5.4.330.0000.00910.77
5.4.320.0060.02211.78
5.4.310.0040.02411.75
5.4.300.0060.02311.67
5.4.290.0040.02111.71
5.4.280.0060.02011.67
5.4.270.0030.02911.80
5.4.260.0020.02611.65
5.4.250.0060.02411.55
5.4.240.0090.02511.71
5.4.230.0090.02511.70
5.4.220.0070.02411.66
5.4.210.0120.02311.68
5.4.200.0110.02611.68
5.4.190.0090.02511.75
5.4.180.0120.02411.64
5.4.170.0090.02611.57
5.4.160.0130.03611.63
5.4.150.0120.02311.68
5.4.140.0090.02411.63
5.4.130.0080.02511.60
5.4.120.0190.04611.53
5.4.110.0060.02911.51
5.4.100.0070.02711.66
5.4.90.0090.02511.58
5.4.80.0090.02411.50
5.4.70.0100.02211.42
5.4.60.0070.02611.57
5.4.50.0110.02211.29
5.4.40.0090.02311.56
5.4.30.0080.02511.55
5.4.20.0110.02311.56
5.4.10.0110.02311.56
5.4.00.0120.02211.29
5.3.290.0060.02511.69
5.3.280.0120.02611.65
5.3.270.0090.02711.62
5.3.260.0210.04511.68
5.3.250.0090.02711.68
5.3.240.0100.02511.62
5.3.230.0110.02511.64
5.3.220.0070.02911.62
5.3.210.0130.02511.62
5.3.200.0070.02811.47
5.3.190.0120.02511.63
5.3.180.0070.02911.70
5.3.170.0080.02911.54
5.3.160.0100.02711.74
5.3.150.0170.04711.75
5.3.140.0100.02611.67
5.3.130.0140.02211.62
5.3.120.0220.04311.49
5.3.110.0100.02611.66
5.3.100.0090.02611.23
5.3.90.0090.02611.38
5.3.80.0100.02511.39
5.3.70.0070.02611.21
5.3.60.0080.02511.33
5.3.50.0170.03211.21
5.3.40.0080.02611.34
5.3.30.0120.02211.33
5.3.20.0110.02211.07
5.3.10.0070.02510.99
5.3.00.0160.03111.05
5.2.170.0130.0339.19
5.2.160.0170.0299.19
5.2.150.0130.0359.19
5.2.140.0120.0349.19
5.2.130.0120.0339.14
5.2.120.0160.0309.14
5.2.110.0110.0359.15
5.2.100.0130.0329.16
5.2.90.0110.0349.15
5.2.80.0090.0379.15
5.2.70.0220.0549.14
5.2.60.0170.0289.09
5.2.50.0090.0389.07
5.2.40.0080.0399.04
5.2.30.0120.0339.02
5.2.20.0130.0349.01
5.2.10.0110.0368.92
5.2.00.0100.0348.77
5.1.60.0110.0298.06
5.1.50.0110.0298.06
5.1.40.0080.0308.04
5.1.30.0080.0358.39
5.1.20.0120.0308.41
5.1.10.0310.0718.14
5.1.00.0150.0278.13
5.0.50.0120.0236.63
5.0.40.0070.0256.46
5.0.30.0090.0356.29
5.0.20.0050.0266.26
5.0.10.0070.0246.23
5.0.00.0120.0326.22
4.4.90.0070.0184.78
4.4.80.0120.0124.76
4.4.70.0080.0174.75
4.4.60.0100.0154.75
4.4.50.0070.0174.77
4.4.40.0070.0314.71
4.4.30.0090.0164.76
4.4.20.0050.0204.84
4.4.10.0090.0174.85
4.4.00.0090.0274.76
4.3.110.0070.0174.67
4.3.100.0050.0194.66
4.3.90.0050.0184.64
4.3.80.0090.0254.58
4.3.70.0100.0144.63
4.3.60.0050.0194.63
4.3.50.0040.0224.62
4.3.40.0100.0234.54
4.3.30.0050.0193.30
4.3.20.0060.0173.27
4.3.10.0040.0183.23
4.3.00.0270.01313.14

preferences:
41.99 ms | 401 KiB | 5 Q