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, 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.0180.00016.88
8.3.50.0110.00421.33
8.3.40.0100.00718.96
8.3.30.0030.01020.21
8.3.20.0070.00020.13
8.3.10.0040.00422.10
8.3.00.0050.00222.46
8.2.180.0100.00616.63
8.2.170.0070.01422.96
8.2.160.0070.00722.34
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00821.18
8.2.110.0040.00422.38
8.2.100.0080.00418.03
8.2.90.0040.00419.08
8.2.80.0080.00019.41
8.2.70.0050.00317.75
8.2.60.0060.00317.80
8.2.50.0080.00018.07
8.2.40.0040.00420.07
8.2.30.0070.00019.39
8.2.20.0060.00317.90
8.2.10.0030.00517.95
8.2.00.0000.01017.93
8.1.280.0070.01325.92
8.1.270.0080.00023.99
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00323.79
8.1.230.0060.00619.17
8.1.220.0040.00417.91
8.1.210.0040.00418.77
8.1.200.0040.00417.60
8.1.190.0050.00317.66
8.1.180.0040.00419.13
8.1.170.0060.00318.71
8.1.160.0000.00918.97
8.1.150.0000.00818.77
8.1.140.0070.00317.57
8.1.130.0030.00317.82
8.1.120.0040.00417.54
8.1.110.0000.00817.69
8.1.100.0070.00017.58
8.1.90.0000.00817.62
8.1.80.0000.00717.72
8.1.70.0000.00717.55
8.1.60.0030.00517.77
8.1.50.0040.00417.72
8.1.40.0040.00417.71
8.1.30.0080.00017.81
8.1.20.0040.00417.69
8.1.10.0000.00817.70
8.1.00.0000.00817.70
8.0.300.0040.00418.77
8.0.290.0040.00417.30
8.0.280.0030.00318.58
8.0.270.0030.00517.27
8.0.260.0000.00616.98
8.0.250.0070.00017.11
8.0.240.0000.00817.14
8.0.230.0020.00517.23
8.0.220.0040.00417.04
8.0.210.0000.00717.11
8.0.200.0070.00017.20
8.0.190.0050.00317.22
8.0.180.0040.00417.10
8.0.170.0080.00017.19
8.0.160.0000.00817.12
8.0.150.0000.00717.09
8.0.140.0050.00217.21
8.0.130.0000.00613.64
8.0.120.0050.00317.12
8.0.110.0000.00817.13
8.0.100.0030.00517.05
8.0.90.0040.00417.20
8.0.80.0070.01017.11
8.0.70.0040.00417.18
8.0.60.0040.00416.96
8.0.50.0040.00417.16
8.0.30.0090.01217.46
8.0.20.0110.00817.40
8.0.10.0040.00417.34
8.0.00.0070.01116.95
7.4.330.0060.00015.03
7.4.320.0030.00316.84
7.4.300.0000.00616.87
7.4.290.0070.00016.64
7.4.280.0070.00016.86
7.4.270.0070.00016.82
7.4.260.0030.00313.57
7.4.250.0000.00716.86
7.4.240.0040.00416.80
7.4.230.0040.00416.59
7.4.220.0030.01716.83
7.4.210.0080.01016.92
7.4.200.0050.00216.91
7.4.190.0040.00416.96
7.4.160.0130.00316.95
7.4.150.0090.00917.40
7.4.140.0050.01317.86
7.4.130.0110.00816.83
7.4.120.0120.00616.96
7.4.110.0150.00316.98
7.4.100.0130.00416.68
7.4.90.0160.00816.84
7.4.80.0040.01219.39
7.4.70.0140.00717.02
7.4.60.0080.00816.91
7.4.50.0040.00416.81
7.4.40.0120.00322.77
7.4.30.0070.01416.80
7.4.10.0000.01815.10
7.4.00.0080.00815.22
7.3.330.0030.00313.51
7.3.320.0000.00513.54
7.3.310.0040.00416.50
7.3.300.0030.00316.63
7.3.290.0070.00716.63
7.3.280.0130.00416.61
7.3.270.0090.00917.40
7.3.260.0130.01016.76
7.3.250.0110.00616.66
7.3.240.0100.00716.80
7.3.230.0100.01316.46
7.3.210.0130.00616.80
7.3.200.0140.00419.39
7.3.190.0060.01116.57
7.3.180.0100.00716.59
7.3.170.0100.00716.91
7.3.160.0170.00316.72
7.3.130.0000.01915.32
7.3.120.0080.01015.09
7.3.110.0100.00915.08
7.3.100.0100.00815.20
7.3.90.0040.01015.09
7.3.80.0050.00615.07
7.3.70.0040.00815.04
7.3.60.0060.00814.87
7.3.50.0100.00415.06
7.3.40.0050.00815.15
7.3.30.0050.00715.03
7.3.20.0060.00716.90
7.3.10.0060.00616.83
7.3.00.0090.00616.75
7.2.330.0140.00516.96
7.2.320.0070.01016.81
7.2.310.0100.01316.87
7.2.300.0110.00616.87
7.2.290.0100.00716.77
7.2.260.0060.01315.31
7.2.250.0060.01415.34
7.2.240.0060.01315.28
7.2.230.0070.01015.29
7.2.220.0070.00915.29
7.2.210.0060.00815.20
7.2.200.0050.01015.28
7.2.190.0050.01015.08
7.2.180.0060.00815.16
7.2.170.0070.00715.28
7.2.160.0050.01215.11
7.2.150.0050.01217.00
7.2.140.0080.00617.03
7.2.130.0050.01017.07
7.2.120.0070.01016.93
7.2.110.0040.01317.17
7.2.100.0080.00717.00
7.2.90.0100.00617.19
7.2.80.0030.01117.19
7.2.70.0010.01217.12
7.2.60.0080.00517.07
7.2.50.0070.00816.97
7.2.40.0020.01017.05
7.2.30.0020.01116.98
7.2.20.0090.00517.04
7.2.10.0070.00917.13
7.2.00.0080.00716.97
7.1.330.0070.00615.90
7.1.320.0070.00615.82
7.1.310.0030.00816.12
7.1.300.0030.01015.92
7.1.290.0070.00616.02
7.1.280.0130.00316.04
7.1.270.0080.00615.93
7.1.260.0050.00816.01
7.1.250.0030.01415.95
7.1.240.0050.00915.84
7.1.230.0070.00716.12
7.1.220.0050.00716.00
7.1.210.0060.00816.03
7.1.200.0040.00915.84
7.1.190.0060.00616.00
7.1.180.0060.00415.92
7.1.170.0060.00815.92
7.1.160.0090.00416.10
7.1.150.0080.00716.14
7.1.140.0050.00615.96
7.1.130.0070.00616.13
7.1.120.0050.00815.94
7.1.110.0080.00615.95
7.1.100.0070.00716.15
7.1.90.0030.01015.92
7.1.80.0040.00616.06
7.1.70.0050.00816.39
7.1.60.0050.00816.40
7.1.50.0040.01116.30
7.1.40.0050.00915.94
7.1.30.0080.00716.01
7.1.20.0050.00515.89
7.1.10.0080.00816.05
7.1.00.0040.02518.02
7.0.330.0060.01015.27
7.0.320.0080.00515.65
7.0.310.0040.00915.72
7.0.300.0040.00815.68
7.0.290.0080.00315.54
7.0.280.0060.00715.57
7.0.270.0040.00615.38
7.0.260.0090.00315.66
7.0.250.0070.00815.52
7.0.240.0030.00715.64
7.0.230.0020.00915.63
7.0.220.0050.00815.40
7.0.210.0050.01015.64
7.0.200.0090.00616.04
7.0.190.0060.00715.49
7.0.180.0050.00715.79
7.0.170.0040.00615.58
7.0.160.0040.01115.63
7.0.150.0040.00715.63
7.0.140.0060.03417.67
7.0.130.0050.00615.64
7.0.120.0010.01015.67
7.0.110.0030.00915.59
7.0.100.0100.00315.49
7.0.90.0000.01315.61
7.0.80.0220.02717.13
7.0.70.0080.02217.03
7.0.60.0090.02916.94
7.0.50.0060.03317.09
7.0.40.0090.02915.81
7.0.30.0060.03215.79
7.0.20.0030.03415.84
7.0.10.0040.03015.79
7.0.00.0060.02315.88
5.6.400.0050.00714.54
5.6.390.0030.01014.63
5.6.380.0060.00914.29
5.6.370.0110.00314.21
5.6.360.0030.01114.49
5.6.350.0050.00714.61
5.6.340.0040.00814.69
5.6.330.0020.01014.56
5.6.320.0030.00914.54
5.6.310.0060.00814.37
5.6.300.0030.01114.60
5.6.290.0080.00614.70
5.6.280.0040.03016.68
5.6.270.0020.01514.59
5.6.260.0070.00314.53
5.6.250.0100.00314.36
5.6.240.0080.00614.55
5.6.230.0070.02016.54
5.6.220.0050.02716.43
5.6.210.0070.03116.30
5.6.200.0050.03516.57
5.6.190.0090.02716.65
5.6.180.0040.02316.61
5.6.170.0050.02416.52
5.6.160.0020.02216.50
5.6.150.0100.03016.65
5.6.140.0040.03516.67
5.6.130.0040.03616.69
5.6.120.0040.03116.53
5.6.110.0060.02116.54
5.6.100.0070.03616.59
5.6.90.0110.02716.58
5.6.80.0050.01816.32
5.6.70.0070.03016.36
5.6.60.0110.02716.51
5.6.50.0050.03116.35
5.6.40.0010.03116.34
5.6.30.0110.02916.36
5.6.20.0050.03416.38
5.6.10.0080.03216.37
5.6.00.0080.02816.44
5.5.380.0070.00614.31
5.5.370.0040.03516.42
5.5.360.0090.03216.40
5.5.350.0030.03616.45
5.5.340.0020.03016.58
5.5.330.0070.03216.44
5.5.320.0080.03016.41
5.5.310.0040.03016.59
5.5.300.0060.03116.50
5.5.290.0040.02916.60
5.5.280.0040.02416.61
5.5.270.0050.03616.57
5.5.260.0050.02716.57
5.5.250.0060.03716.50
5.5.240.0070.03216.33
5.5.230.0030.03116.25
5.5.220.0060.02316.32
5.5.210.0140.01616.32
5.5.200.0080.03216.16
5.5.190.0090.02816.32
5.5.180.0040.02316.30
5.5.170.0050.00814.22
5.5.160.0050.03216.22
5.5.150.0090.01816.28
5.5.140.0090.02616.14
5.5.130.0070.02516.24
5.5.120.0080.02016.27
5.5.110.0060.03116.26
5.5.100.0090.02816.26
5.5.90.0060.02516.16
5.5.80.0050.02016.09
5.5.70.0060.03316.05
5.5.60.0080.02616.22
5.5.50.0070.03316.14
5.5.40.0030.03516.27
5.5.30.0070.03216.27
5.5.20.0070.02916.27
5.5.10.0050.03316.25
5.5.00.0030.03416.19
5.4.450.0100.02014.27
5.4.440.0040.02314.24
5.4.430.0070.02214.17
5.4.420.0030.03214.20
5.4.410.0040.02714.18
5.4.400.0050.02714.14
5.4.390.0040.03014.16
5.4.380.0060.02914.15
5.4.370.0080.02714.07
5.4.360.0080.02814.19
5.4.350.0030.03314.03
5.4.340.0040.03014.01
5.4.330.0060.00411.63
5.4.320.0050.03013.93
5.4.310.0090.02814.01
5.4.300.0080.01914.11
5.4.290.0070.02313.99
5.4.280.0070.02614.08
5.4.270.0030.03113.98
5.4.260.0080.02514.17
5.4.250.0050.03114.00
5.4.240.0070.02814.15
5.4.230.0050.02014.08
5.4.220.0060.01814.15
5.4.210.0050.02914.11
5.4.200.0060.03014.13
5.4.190.0030.02614.14
5.4.180.0090.02213.99
5.4.170.0090.02614.14
5.4.160.0060.02514.17
5.4.150.0060.02214.09
5.4.140.0050.02313.14
5.4.130.0030.02913.16
5.4.120.0080.02513.24
5.4.110.0060.02813.24
5.4.100.0050.02213.26
5.4.90.0070.01813.17
5.4.80.0040.02313.36
5.4.70.0090.02313.31
5.4.60.0030.03213.18
5.4.50.0020.02813.21
5.4.40.0040.02413.28
5.4.30.0050.01713.12
5.4.20.0040.03113.21
5.4.10.0040.02713.29
5.4.00.0010.02613.15
5.3.290.0020.02012.99
5.3.280.0080.02812.96
5.3.270.0080.02712.98
5.3.260.0060.02612.98
5.3.250.0030.02013.00
5.3.240.0030.03212.86
5.3.230.0060.02312.97
5.3.220.0070.02312.84
5.3.210.0030.03112.93
5.3.200.0050.02012.90
5.3.190.0060.01812.92
5.3.180.0050.01812.93
5.3.170.0050.02812.91
5.3.160.0050.02912.99
5.3.150.0010.02212.96
5.3.140.0030.03112.97
5.3.130.0030.03312.97
5.3.120.0040.02812.97
5.3.110.0060.02512.96
5.3.100.0040.02912.97
5.3.90.0060.01912.99
5.3.80.0060.02512.84
5.3.70.0030.02512.93
5.3.60.0030.03012.86
5.3.50.0050.03012.89
5.3.40.0050.02712.97
5.3.30.0050.01812.90
5.3.20.0050.02412.99
5.3.10.0040.02812.91
5.3.00.0060.02512.81
5.2.170.0100.04716.14
5.2.160.0100.05316.14
5.2.150.0000.06316.14
5.2.140.0070.05016.14
5.2.130.0130.05016.14
5.2.120.0070.06016.14
5.2.110.0030.06716.14
5.2.100.0100.05716.14
5.2.90.0030.06316.14
5.2.80.0070.05716.14
5.2.70.0000.04716.14
5.2.60.0030.06316.14
5.2.50.0030.06316.14
5.2.40.0070.03716.14
5.2.30.0100.03016.14
5.2.20.0100.06016.14
5.2.10.0100.05716.14
5.2.00.0030.06316.14
5.1.60.0000.03716.14
5.1.50.0070.04016.14
5.1.40.0000.04016.14
5.1.30.0100.05016.14
5.1.20.0100.05016.14
5.1.10.0100.04316.14
5.1.00.0100.04716.14
5.0.50.0030.04016.14
5.0.40.0030.03016.14
5.0.30.0030.05316.14
5.0.20.0070.03716.14
5.0.10.0030.04716.14
5.0.00.0000.07016.14
4.4.90.0030.03016.14
4.4.80.0000.03716.14
4.4.70.0000.03716.14
4.4.60.0030.02716.14
4.4.50.0070.03016.14
4.4.40.0000.05716.14
4.4.30.0100.02316.14
4.4.20.0000.03016.14
4.4.10.0030.03316.14
4.4.00.0070.05016.14
4.3.110.0030.03716.14
4.3.100.0030.03316.14
4.3.90.0000.03016.14
4.3.80.0000.04316.14
4.3.70.0000.03716.14
4.3.60.0000.04016.14
4.3.50.0070.03316.14
4.3.40.0000.05016.14
4.3.30.0030.02716.14
4.3.20.0030.03316.14
4.3.10.0000.02716.14
4.3.00.0030.02716.14

preferences:
44.18 ms | 401 KiB | 5 Q