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($strpos); 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.0090.00918.68
8.3.50.0080.01421.98
8.3.40.0140.00019.10
8.3.30.0030.01020.29
8.3.20.0030.00520.48
8.3.10.0000.00822.08
8.3.00.0030.00522.50
8.2.180.0090.00616.63
8.2.170.0120.00322.96
8.2.160.0100.00322.38
8.2.150.0000.00924.18
8.2.140.0030.00624.66
8.2.130.0080.00026.16
8.2.120.0060.00320.78
8.2.110.0100.01022.07
8.2.100.0060.00917.87
8.2.90.0040.00419.39
8.2.80.0040.00419.24
8.2.70.0000.00817.75
8.2.60.0060.00318.04
8.2.50.0050.00518.07
8.2.40.0000.00818.22
8.2.30.0030.00619.52
8.2.20.0080.00017.93
8.2.10.0000.00818.00
8.2.00.0080.00018.06
8.1.280.0140.00325.92
8.1.270.0040.00423.99
8.1.260.0000.00926.35
8.1.250.0080.00028.09
8.1.240.0100.00723.91
8.1.230.0030.01019.13
8.1.220.0030.00618.02
8.1.210.0080.00018.77
8.1.200.0030.00717.73
8.1.190.0000.00917.78
8.1.180.0030.00519.26
8.1.170.0040.00418.86
8.1.160.0030.00618.95
8.1.150.0000.00818.72
8.1.140.0000.00717.54
8.1.130.0000.00717.97
8.1.120.0070.00017.69
8.1.110.0000.00717.65
8.1.100.0000.00717.72
8.1.90.0050.00317.57
8.1.80.0050.00317.70
8.1.70.0000.00717.67
8.1.60.0040.00417.71
8.1.50.0050.00317.74
8.1.40.0000.00917.65
8.1.30.0000.00817.78
8.1.20.0080.00017.93
8.1.10.0040.00417.68
8.1.00.0050.00317.65
8.0.300.0080.00018.96
8.0.290.0000.00717.41
8.0.280.0000.00718.44
8.0.270.0070.00017.39
8.0.260.0030.00317.11
8.0.250.0000.00717.20
8.0.240.0040.00417.23
8.0.230.0040.00417.20
8.0.220.0050.00217.22
8.0.210.0030.00317.17
8.0.200.0000.00717.22
8.0.190.0040.00417.22
8.0.180.0040.00417.04
8.0.170.0030.00517.22
8.0.160.0080.00017.16
8.0.150.0000.00717.03
8.0.140.0030.00517.08
8.0.130.0000.00513.64
8.0.120.0030.00517.09
8.0.110.0030.00517.02
8.0.100.0040.00417.00
8.0.90.0000.00716.96
8.0.80.0100.01017.13
8.0.70.0070.00017.16
8.0.60.0000.00717.23
8.0.50.0080.00017.20
8.0.30.0150.00417.31
8.0.20.0080.01217.50
8.0.10.0020.00517.19
8.0.00.0080.00917.19
7.4.330.0050.00015.07
7.4.320.0030.00316.92
7.4.300.0030.00316.93
7.4.290.0000.00716.78
7.4.280.0000.00816.77
7.4.270.0030.00316.80
7.4.260.0000.00813.52
7.4.250.0040.00416.77
7.4.240.0040.00316.90
7.4.230.0040.00416.67
7.4.220.0090.01016.96
7.4.210.0120.00516.82
7.4.200.0000.00716.96
7.4.190.0040.00416.88
7.4.160.0100.01016.86
7.4.150.0120.01217.40
7.4.140.0070.01017.86
7.4.130.0080.01016.80
7.4.120.0090.00816.87
7.4.110.0040.01416.64
7.4.100.0030.01316.90
7.4.90.0070.01016.89
7.4.80.0120.00819.39
7.4.70.0060.01216.89
7.4.60.0070.01016.90
7.4.50.0030.00516.46
7.4.40.0090.00922.77
7.4.30.0110.01116.78
7.4.00.0070.01115.11
7.3.330.0000.00513.63
7.3.320.0000.00513.37
7.3.310.0000.00716.48
7.3.300.0000.00716.48
7.3.290.0080.00616.53
7.3.280.0070.00916.57
7.3.270.0000.01717.40
7.3.260.0110.01116.78
7.3.250.0160.00616.75
7.3.240.0160.00616.58
7.3.230.0030.02116.75
7.3.210.0060.01016.79
7.3.200.0040.01419.39
7.3.190.0190.00316.71
7.3.180.0100.00716.66
7.3.170.0120.00416.63
7.3.160.0180.00416.95
7.3.120.0090.00614.99
7.3.10.0070.00716.82
7.3.00.0140.00016.99
7.2.330.0120.00616.91
7.2.320.0110.00616.86
7.2.310.0190.00616.89
7.2.300.0120.00516.87
7.2.290.0100.00716.91
7.2.130.0030.01016.85
7.2.120.0190.00317.13
7.2.110.0100.00716.93
7.2.100.0100.00716.96
7.2.90.0000.01116.94
7.2.80.0090.00617.03
7.2.70.0030.01216.91
7.2.60.0090.00617.13
7.2.50.0070.01016.95
7.2.40.0040.00417.02
7.2.30.0030.01217.18
7.2.20.0090.00017.06
7.2.10.0120.00917.18
7.2.00.0110.01018.11
7.1.250.0060.00315.75
7.1.240.0000.01215.79
7.1.230.0030.01215.88
7.1.220.0160.00316.04
7.1.210.0070.00715.95
7.1.200.0080.00315.88
7.1.190.0040.01116.16
7.1.180.0080.00416.21
7.1.170.0110.00715.88
7.1.160.0050.00316.11
7.1.150.0070.00015.71
7.1.140.0060.00316.04
7.1.130.0070.00716.07
7.1.120.0130.00715.98
7.1.110.0060.00915.98
7.1.100.0170.00717.22
7.1.90.0100.00615.79
7.1.80.0060.01015.68
7.1.70.0030.00816.54
7.1.60.0050.00716.89
7.1.50.0030.00716.43
7.1.40.0040.00816.02
7.1.30.0030.01015.73
7.1.20.0070.00715.98
7.1.10.0000.01115.84
7.1.00.0020.03019.26
7.0.330.0060.00615.41
7.0.320.0040.00815.53
7.0.310.0060.00615.68
7.0.300.0130.00315.41
7.0.290.0050.00315.64
7.0.280.0030.00915.68
7.0.270.0100.00715.63
7.0.260.0030.00615.74
7.0.250.0110.00715.61
7.0.240.0070.01315.66
7.0.230.0110.00415.45
7.0.220.0170.00315.49
7.0.210.0060.00915.70
7.0.200.0050.00816.13
7.0.190.0030.01015.41
7.0.180.0110.00715.55
7.0.170.0000.01115.58
7.0.160.0100.00315.67
7.0.150.0100.00315.29
7.0.140.0050.04218.88
7.0.130.0030.00715.49
7.0.120.0040.00415.66
7.0.110.0100.04117.72
7.0.100.0030.03017.69
7.0.90.0080.04217.87
7.0.80.0080.04017.79
7.0.70.0100.03717.79
7.0.60.0050.04317.77
7.0.50.0020.04517.91
7.0.40.0060.03816.72
7.0.30.0080.03616.85
7.0.20.0100.04316.89
7.0.10.0030.04816.75
7.0.00.0030.04516.79
5.6.380.0060.00914.20
5.6.370.0060.01014.62
5.6.360.0040.01114.21
5.6.350.0060.00614.54
5.6.340.0000.01114.36
5.6.330.0100.00314.04
5.6.320.0040.00414.24
5.6.310.0070.00414.25
5.6.300.0030.01014.55
5.6.290.0000.00914.40
5.6.280.0030.04017.68
5.6.270.0070.01014.22
5.6.260.0060.00314.45
5.6.250.0080.02817.59
5.6.240.0050.04317.46
5.6.230.0100.03517.49
5.6.220.0140.03817.39
5.6.210.0030.04517.47
5.6.200.0050.03917.70
5.6.190.0120.03617.71
5.6.180.0050.04517.75
5.6.170.0100.04217.55
5.6.160.0070.04217.72
5.6.150.0100.04217.78
5.6.140.0050.04317.83
5.6.130.0110.03817.65
5.6.120.0070.03717.96
5.6.110.0100.04317.69
5.6.100.0070.04317.64
5.6.90.0070.04517.79
5.6.80.0050.04517.25
5.6.70.0040.04917.29
5.6.60.0050.02917.28
5.6.50.0110.04417.25
5.6.40.0070.04017.47
5.6.30.0020.04917.37
5.6.20.0050.04417.44
5.6.10.0050.04217.43
5.6.00.0120.04017.34
5.5.380.0070.04116.07
5.5.370.0120.03216.04
5.5.360.0050.04515.93
5.5.350.0080.03516.04
5.5.340.0100.03016.25
5.5.330.0050.03916.21
5.5.320.0100.04216.15
5.5.310.0080.04016.28
5.5.300.0070.04016.25
5.5.290.0050.04916.29
5.5.280.0120.03316.27
5.5.270.0100.04016.28
5.5.260.0070.04316.22
5.5.250.0130.03716.16
5.5.240.0060.02615.95
5.5.230.0100.04015.94
5.5.220.0120.03715.94
5.5.210.0070.02815.93
5.5.200.0060.02615.92
5.5.190.0090.03615.93
5.5.180.0080.04115.93
5.5.170.0040.00711.64
5.5.160.0030.04315.97
5.5.150.0100.04015.82
5.5.140.0060.04315.88
5.5.130.0050.04015.86
5.5.120.0080.03815.91
5.5.110.0090.03915.98
5.5.100.0060.03615.93
5.5.90.0080.04115.94
5.5.80.0130.03315.80
5.5.70.0050.04315.84
5.5.60.0050.02515.88
5.5.50.0080.04015.92
5.5.40.0100.03215.79
5.5.30.0070.03815.82
5.5.20.0020.04315.79
5.5.10.0050.02615.87
5.5.00.0070.03715.83
5.4.450.0030.04315.61
5.4.440.0050.04315.56
5.4.430.0160.03115.46
5.4.420.0100.04015.48
5.4.410.0070.03615.52
5.4.400.0070.04315.44
5.4.390.0030.04215.41
5.4.380.0080.04115.36
5.4.370.0040.04215.31
5.4.360.0060.03315.31
5.4.350.0030.04115.41
5.4.340.0080.03015.32
5.4.330.0050.00311.64
5.4.320.0080.03715.29
5.4.310.0060.02515.40
5.4.300.0070.02515.46
5.4.290.0130.03615.34
5.4.280.0090.03515.37
5.4.270.0040.02215.33
5.4.260.0080.03515.39
5.4.250.0070.03715.30
5.4.240.0090.02315.31
5.4.230.0080.04215.31
5.4.220.0050.02415.29
5.4.210.0060.03615.33
5.4.200.0110.03315.38
5.4.190.0090.03915.30
5.4.180.0110.03015.30
5.4.170.0060.03815.47
5.4.160.0020.03815.39
5.4.150.0030.04015.30
5.4.140.0050.03913.97
5.4.130.0050.03914.00
5.4.120.0000.04414.04
5.4.110.0070.03814.03
5.4.100.0100.03714.17
5.4.90.0030.04114.08
5.4.80.0070.03714.07
5.4.70.0050.02314.07
5.4.60.0030.03714.08
5.4.50.0060.03814.10
5.4.40.0070.03714.04
5.4.30.0020.04213.98
5.4.20.0110.03513.97
5.4.10.0060.03814.08
5.4.00.0070.04013.79
5.3.290.0050.04213.18
5.3.280.0060.03413.12
5.3.270.0110.03213.06
5.3.260.0090.03313.15
5.3.250.0050.03913.15
5.3.240.0030.02513.13
5.3.230.0070.03513.12
5.3.220.0070.03913.11
5.3.210.0050.04013.11
5.3.200.0060.04013.13
5.3.190.0030.04513.19
5.3.180.0070.03813.15
5.3.170.0050.03113.22
5.3.160.0070.03713.11
5.3.150.0060.04013.12
5.3.140.0070.03713.10
5.3.130.0020.04113.03
5.3.120.0050.02613.10
5.3.110.0060.04013.11
5.3.100.0040.04012.84
5.3.90.0050.04012.85
5.3.80.0050.03612.84
5.3.70.0030.04112.77
5.3.60.0060.03912.83
5.3.50.0030.04112.79
5.3.40.0090.03412.81
5.3.30.0070.03812.78
5.3.20.0050.03612.74
5.3.10.0100.02812.69
5.3.00.0020.02412.66
5.2.170.0030.03711.51
5.2.160.0030.03411.39
5.2.150.0060.03011.40
5.2.140.0070.02211.39
5.2.130.0050.02011.49
5.2.120.0060.01811.35
5.2.110.0020.01711.36
5.2.100.0020.02911.36
5.2.90.0020.01711.44
5.2.80.0010.01911.35
5.2.70.0050.01611.43
5.2.60.0040.01611.46
5.2.50.0030.01811.34
5.2.40.0040.01611.26
5.2.30.0030.02711.29
5.2.20.0000.01811.37
5.2.10.0000.01911.26
5.2.00.0020.02111.16
5.1.60.0030.01110.86
5.1.50.0020.01510.80
5.1.40.0030.01410.80
5.1.30.0000.01711.06
5.1.20.0000.01811.00
5.1.10.0000.02910.86
5.1.00.0040.01710.98
5.0.50.0020.01310.31
5.0.40.0020.01210.31
5.0.30.0020.02310.31
5.0.20.0010.01110.31
5.0.10.0030.01010.31
5.0.00.0010.01610.31
4.4.90.0020.00910.31
4.4.80.0020.01210.31
4.4.70.0040.00810.31
4.4.60.0030.01310.31
4.4.50.0020.00910.31
4.4.40.0020.01310.31
4.4.30.0020.01810.31
4.4.20.0020.00810.31
4.4.10.0000.01110.31
4.4.00.0050.01710.31
4.3.110.0000.01810.31
4.3.100.0020.00810.31
4.3.90.0000.01210.31
4.3.80.0030.01110.31
4.3.70.0030.01010.31
4.3.60.0020.01710.31
4.3.50.0020.01210.31
4.3.40.0030.01310.31
4.3.30.0020.00810.31
4.3.20.0000.01010.31
4.3.10.0020.01010.31
4.3.00.0020.00810.31

preferences:
55.93 ms | 401 KiB | 5 Q