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('|', $massagedNeedles); } else { $regexp = preg_replace('/' . $wordDelimiter . '/', preg_quote($needle, '/')); } $regexp = sprintf('/%s/i', $regexp); $strpos = preg_match($regexp, $haystack, $matches, PREG_OFFSET_CAPTURE, $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.0130.00316.88
8.3.50.0100.00717.63
8.3.40.0060.00919.13
8.3.30.0070.00718.92
8.3.20.0080.00018.88
8.3.10.0060.00318.98
8.3.00.0000.00819.51
8.2.180.0070.01118.54
8.2.170.0110.00322.96
8.2.160.0140.00020.64
8.2.150.0070.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0040.00420.90
8.2.110.0070.00321.09
8.2.100.0030.00718.09
8.2.90.0030.00619.40
8.2.80.0070.00019.50
8.2.70.0050.00317.75
8.2.60.0070.00717.80
8.2.50.0000.00818.07
8.2.40.0030.00618.10
8.2.30.0080.00318.16
8.2.20.0050.00317.88
8.2.10.0000.00718.05
8.2.00.0040.00418.07
8.1.280.0070.01125.92
8.1.270.0200.00024.66
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00022.41
8.1.230.0100.00320.88
8.1.220.0030.00517.80
8.1.210.0000.00919.00
8.1.200.0030.00617.59
8.1.190.0030.00517.79
8.1.180.0000.00918.10
8.1.170.0040.00418.93
8.1.160.0080.00018.88
8.1.150.0030.00518.88
8.1.140.0040.00417.53
8.1.130.0050.00217.95
8.1.120.0050.00317.68
8.1.110.0040.00417.66
8.1.100.0040.00417.71
8.1.90.0070.00017.52
8.1.80.0000.00717.68
8.1.70.0000.00717.66
8.1.60.0040.00417.83
8.1.50.0000.00917.70
8.1.40.0030.00617.62
8.1.30.0040.00417.85
8.1.20.0000.00817.82
8.1.10.0040.00417.76
8.1.00.0080.00017.65
8.0.300.0050.00220.03
8.0.290.0040.00417.00
8.0.280.0040.00418.54
8.0.270.0000.00717.39
8.0.260.0050.00217.10
8.0.250.0000.00817.25
8.0.240.0000.00717.25
8.0.230.0000.00817.29
8.0.220.0030.00517.03
8.0.210.0030.00517.06
8.0.200.0070.00017.23
8.0.190.0000.00817.19
8.0.180.0070.00017.13
8.0.170.0090.00017.13
8.0.160.0070.00017.21
8.0.150.0000.00817.11
8.0.140.0040.00417.14
8.0.130.0060.00013.53
8.0.120.0000.00817.16
8.0.110.0050.00217.09
8.0.100.0080.00017.11
8.0.90.0050.00217.19
8.0.80.0040.01817.05
8.0.70.0080.00017.18
8.0.60.0040.00417.11
8.0.50.0040.00417.04
8.0.30.0140.00517.06
8.0.20.0060.01217.20
8.0.10.0000.00817.18
8.0.00.0140.00616.86
7.4.330.0020.00213.26
7.4.320.0030.00316.78
7.4.300.0040.00416.80
7.4.290.0040.00416.78
7.4.280.0080.00016.77
7.4.270.0000.00716.64
7.4.260.0030.00313.48
7.4.250.0040.00416.81
7.4.240.0050.00216.86
7.4.230.0030.00316.96
7.4.220.0070.01116.83
7.4.210.0130.00416.80
7.4.200.0000.00816.68
7.4.190.0050.00317.04
7.4.160.0050.01016.79
7.4.150.0150.00316.89
7.4.140.0130.01016.89
7.4.130.0050.01216.79
7.4.120.0100.00816.86
7.4.110.0090.01216.86
7.4.100.0090.01116.84
7.4.90.0040.01516.80
7.4.80.0080.00819.39
7.4.70.0110.00716.84
7.4.60.0090.00916.81
7.4.50.0110.00016.48
7.4.40.0070.01016.67
7.4.30.0130.00316.78
7.4.00.0090.00815.36
7.3.330.0030.00313.64
7.3.320.0000.00513.61
7.3.310.0080.00016.51
7.3.300.0070.00016.62
7.3.290.0000.01416.52
7.3.280.0100.00716.61
7.3.270.0090.00916.72
7.3.260.0170.00016.85
7.3.250.0130.00516.75
7.3.240.0130.01016.70
7.3.230.0150.00316.65
7.3.210.0060.01216.50
7.3.200.0100.01016.95
7.3.190.0110.00516.81
7.3.180.0060.00916.54
7.3.170.0060.01316.52
7.3.160.0060.01316.73
7.3.120.0110.00415.16
7.3.110.0000.01415.01
7.3.100.0110.00314.95
7.3.90.0100.00714.82
7.3.80.0030.00715.33
7.3.70.0030.00915.20
7.3.60.0070.00714.92
7.3.50.0070.00715.13
7.3.40.0110.00415.05
7.3.30.0070.00715.18
7.3.20.0090.00616.93
7.3.10.0050.00816.81
7.3.00.0100.00516.65
7.2.330.0080.01416.91
7.2.320.0120.00616.76
7.2.310.0170.00716.80
7.2.300.0120.00616.81
7.2.290.0080.00816.95
7.2.250.0090.00615.39
7.2.240.0060.00915.34
7.2.230.0060.00915.35
7.2.220.0100.00315.40
7.2.210.0000.01215.19
7.2.200.0100.00714.98
7.2.190.0090.00615.33
7.2.180.0070.00715.25
7.2.170.0070.00315.29
7.2.130.0160.00317.12
7.2.120.0070.00716.84
7.2.110.0120.00616.77
7.2.100.0200.00316.79
7.2.90.0080.00416.70
7.2.80.0120.00817.01
7.2.70.0110.00816.92
7.2.60.0160.00317.05
7.2.50.0130.00916.95
7.2.40.0220.00417.04
7.2.30.0080.01117.06
7.2.20.0360.00716.88
7.2.10.0140.00316.84
7.2.00.0060.00918.21
7.1.330.0090.00615.78
7.1.320.0030.00915.95
7.1.310.0070.01016.24
7.1.300.0030.01016.14
7.1.290.0040.00815.79
7.1.280.0040.01215.73
7.1.270.0000.01416.14
7.1.260.0030.01015.84
7.1.250.0070.00715.82
7.1.100.0110.00418.43
7.1.70.0000.01217.55
7.1.60.0150.00919.40
7.1.50.0090.00917.18
7.1.00.0000.08322.43
7.0.200.0160.00615.13
7.0.140.0070.07021.99
7.0.120.0030.04321.96
7.0.60.0170.08321.81
7.0.50.0130.08317.91
7.0.40.0170.07720.15
7.0.30.0100.08720.26
7.0.20.0170.04720.29
7.0.10.0070.08720.25
7.0.00.0070.07320.03
5.6.280.0000.07721.00
5.6.210.0070.06320.74
5.6.200.0030.06018.14
5.6.190.0130.09320.33
5.6.180.0030.07720.61
5.6.170.0100.07020.55
5.6.160.0100.04020.77
5.6.150.0200.07020.51
5.6.140.0130.04320.17
5.6.130.0030.08320.57
5.6.120.0100.05020.40
5.6.110.0070.05320.33
5.6.100.0070.05020.30
5.6.90.0130.08020.29
5.6.80.0070.08019.58
5.6.70.0130.07719.83
5.6.60.0100.07719.80
5.6.50.0070.08019.79
5.6.40.0070.06019.73
5.6.30.0000.08719.76
5.6.20.0030.04719.76
5.6.10.0100.07719.55
5.6.00.0130.04719.79
5.5.350.0200.07720.43
5.5.340.0100.08018.05
5.5.330.0170.07020.56
5.5.320.0130.07720.27
5.5.310.0130.04720.57
5.5.300.0100.06320.20
5.5.290.0070.05720.24
5.5.280.0030.05319.99
5.5.270.0100.03720.16
5.5.260.0100.08020.12
5.5.250.0030.08319.93
5.5.240.0070.08019.60
5.5.230.0030.08019.70
5.5.220.0030.07019.41
5.5.210.0000.05719.61
5.5.200.0100.04019.64
5.5.190.0100.06319.49
5.5.180.0070.05719.32
5.5.160.0100.07019.31
5.5.150.0030.07719.34
5.5.140.0070.08019.65
5.5.130.0070.07019.31
5.5.120.0000.05019.52
5.5.110.0130.07319.58
5.5.100.0000.06019.37
5.5.90.0070.06319.39
5.5.80.0070.07019.55
5.5.70.0100.03319.38
5.5.60.0070.05319.38
5.5.50.0100.07019.21
5.5.40.0100.03719.38
5.5.30.0030.06719.32
5.5.20.0030.08319.32
5.5.10.0170.07019.51
5.5.00.0000.07019.50
5.4.450.0000.05019.51
5.4.440.0070.04719.43
5.4.430.0000.04319.26
5.4.420.0100.07019.30
5.4.410.0030.08019.34
5.4.400.0000.05318.86
5.4.390.0130.05018.85
5.4.380.0070.06019.12
5.4.370.0070.05019.14
5.4.360.0000.04719.02
5.4.350.0000.04718.92
5.4.340.0030.05019.07
5.4.320.0030.08319.24
5.4.310.0030.04019.24
5.4.300.0030.07018.87
5.4.290.0100.04019.14
5.4.280.0100.06319.17
5.4.270.0070.07018.87
5.4.260.0030.08019.16
5.4.250.0070.07019.20
5.4.240.0070.04718.87
5.4.230.0030.03719.11
5.4.220.0000.04018.86
5.4.210.0030.03719.24
5.4.200.0030.07019.13
5.4.190.0070.06319.13
5.4.180.0030.05318.89
5.4.170.0030.06718.95
5.4.160.0130.07019.19
5.4.150.0100.03718.98
5.4.140.0070.06016.41
5.4.130.0000.08016.36
5.4.120.0100.06016.34
5.4.110.0070.06016.46
5.4.100.0070.07016.35
5.4.90.0130.04716.44
5.4.80.0130.07016.30
5.4.70.0000.05716.43
5.4.60.0070.06016.37
5.4.50.0030.03716.36
5.4.40.0130.06716.27
5.4.30.0030.04016.54
5.4.20.0070.05016.41
5.4.10.0100.02716.50
5.4.00.0000.03715.86
5.3.290.0130.06314.76
5.3.280.0130.06714.54
5.3.270.0070.07014.55
5.3.260.0130.07314.67
5.3.250.0100.07314.69
5.3.240.0130.06014.65
5.3.230.0070.08014.69
5.3.220.0070.05714.59
5.3.210.0030.07714.50
5.3.200.0070.07014.59
5.3.190.0000.06714.64
5.3.180.0130.06314.58
5.3.170.0030.07714.59
5.3.160.0030.04314.62
5.3.150.0130.03014.62
5.3.140.0170.06714.73
5.3.130.0030.08014.59
5.3.120.0100.03714.59
5.3.110.0030.03714.56
5.3.100.0030.03714.06
5.3.90.0000.04014.04
5.3.80.0030.03714.20
5.3.70.0030.03714.09
5.3.60.0030.03714.17
5.3.50.0030.03713.97
5.3.40.0000.03714.05
5.3.30.0000.03713.98
5.3.20.0000.04013.79
5.3.10.0030.03313.75
5.3.00.0070.03313.67
5.2.170.0000.03011.22
5.2.160.0170.02011.03
5.2.150.0000.03011.11
5.2.140.0000.03711.31
5.2.130.0000.03011.27
5.2.120.0030.02711.16
5.2.110.0030.02711.18
5.2.100.0070.02311.06
5.2.90.0030.02711.15
5.2.80.0070.02311.15
5.2.70.0000.03011.09
5.2.60.0000.03011.11
5.2.50.0030.03010.97
5.2.40.0030.03011.00
5.2.30.0100.03011.00
5.2.20.0030.03010.88
5.2.10.0070.02310.88
5.2.00.0030.02710.68
5.1.60.0000.02710.05
5.1.50.0030.0239.90
5.1.40.0000.02710.00
5.1.30.0000.02710.41
5.1.20.0030.03010.36
5.1.10.0000.0279.98
5.1.00.0030.02310.06
5.0.50.0000.0208.61
5.0.40.0000.0208.44
5.0.30.0000.0308.24
5.0.20.0000.0208.19
5.0.10.0000.0208.15
5.0.00.0030.0308.21
4.4.90.0000.0176.55
4.4.80.0000.0176.55
4.4.70.0000.0176.55
4.4.60.0000.0306.55
4.4.50.0000.0336.55
4.4.40.0000.0236.55
4.4.30.0000.0176.55
4.4.20.0030.0136.55
4.4.10.0030.0136.55
4.4.00.0000.0236.55
4.3.110.0000.0176.55
4.3.100.0000.0136.55
4.3.90.0000.0136.55
4.3.80.0000.0236.55
4.3.70.0000.0136.55
4.3.60.0000.0136.55
4.3.50.0000.0136.55
4.3.40.0000.0236.55
4.3.30.0000.0136.55
4.3.20.0000.0136.55
4.3.10.0000.0176.55
4.3.00.0000.0136.55

preferences:
39.31 ms | 401 KiB | 5 Q