3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tagify($str, $baseUrl = '/board/') { $regExp = '/ (?!<a[^<>]*>[^\#]*) # Dont match if there is an opening link tag and any chars after it. \#([-_\w]+\b) # Match the hashtag. (?![^<]*<\/a>) # Ignore any closing link tag including any chars before it not in hashtag. /ix'; $baseUrl = rtrim($baseUrl, '/'); return preg_replace($regExp, '<a href="'.$baseUrl.'/$1">#$1</a>', $str); } $str = <<<STR This is <a href="http://foo.com">This is #foo</a>. Simple #html-stuff text <a href="http://foobar.com#baz">#simple</a> <span class="simple">simple #simple text text</span> STR; echo tagify($str);

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.0160.00018.56
8.3.50.0120.00722.11
8.3.40.0090.00618.79
8.3.30.0040.01118.92
8.3.20.0160.00318.85
8.3.10.0050.00320.66
8.3.00.0030.00717.50
8.2.180.0100.00716.63
8.2.170.0110.00722.96
8.2.160.0070.00722.34
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0030.00526.16
8.2.120.0040.00419.85
8.2.110.0060.00319.27
8.2.100.0070.01117.78
8.2.90.0040.00419.22
8.2.80.0060.00317.97
8.2.70.0090.00017.63
8.2.60.0000.00817.93
8.2.50.0040.00418.10
8.2.40.0080.00018.16
8.2.30.0050.00319.75
8.2.20.0050.00317.70
8.2.10.0040.00417.82
8.2.00.0000.00717.86
8.1.280.0100.01425.92
8.1.270.0000.00723.99
8.1.260.0030.00526.35
8.1.250.0000.00828.09
8.1.240.0030.00619.37
8.1.230.0090.00317.83
8.1.220.0080.00017.77
8.1.210.0000.00818.77
8.1.200.0000.00817.48
8.1.190.0080.00017.21
8.1.180.0040.00418.10
8.1.170.0000.00818.91
8.1.160.0050.00218.80
8.1.150.0040.00418.75
8.1.140.0050.00217.61
8.1.130.0000.00717.83
8.1.120.0070.00017.52
8.1.110.0070.00417.62
8.1.100.0040.00417.54
8.1.90.0040.00417.60
8.1.80.0000.00717.57
8.1.70.0000.00717.57
8.1.60.0000.00817.63
8.1.50.0030.00617.64
8.1.40.0040.00417.63
8.1.30.0050.00317.80
8.1.20.0090.00017.88
8.1.10.0080.00017.68
8.1.00.0000.00717.54
8.0.300.0080.00018.90
8.0.290.0030.00617.00
8.0.280.0050.00318.37
8.0.270.0000.00717.28
8.0.260.0030.00318.47
8.0.250.0000.00717.11
8.0.240.0000.00817.19
8.0.230.0040.00417.15
8.0.220.0000.00717.07
8.0.210.0030.00317.07
8.0.200.0000.00817.21
8.0.190.0070.00017.14
8.0.180.0040.00417.00
8.0.170.0000.00817.09
8.0.160.0000.00717.14
8.0.150.0050.00317.01
8.0.140.0050.00517.15
8.0.130.0030.00313.55
8.0.120.0000.00716.97
8.0.110.0000.00717.04
8.0.100.0040.00417.14
8.0.90.0040.00417.09
8.0.80.0070.01017.04
8.0.70.0040.00417.04
8.0.60.0070.00016.95
8.0.50.0000.00817.02
8.0.30.0110.00917.19
8.0.20.0120.00617.40
8.0.10.0000.00716.97
8.0.00.0050.01516.91
7.4.330.0000.00514.98
7.4.320.0000.00616.55
7.4.300.0000.00616.76
7.4.290.0030.00516.64
7.4.280.0070.00016.71
7.4.270.0070.00016.79
7.4.260.0060.00013.49
7.4.250.0000.00816.81
7.4.240.0000.00716.75
7.4.230.0060.00316.62
7.4.220.0040.01416.57
7.4.210.0090.00616.85
7.4.200.0030.00416.83
7.4.190.0080.00016.77
7.4.160.0090.00616.66
7.4.150.0030.01617.40
7.4.140.0080.01117.21
7.4.130.0060.01116.72
7.4.120.0110.00616.77
7.4.110.0110.00716.71
7.4.100.0120.00616.70
7.4.90.0120.00616.62
7.4.80.0070.01019.03
7.4.70.0150.00416.64
7.4.60.0100.00716.66
7.4.50.0070.00016.54
7.4.40.0030.01322.27
7.4.30.0100.00616.65
7.4.00.0060.00815.42
7.3.330.0050.00013.53
7.3.320.0070.00013.34
7.3.310.0000.00716.39
7.3.300.0070.00016.45
7.3.290.0000.01416.51
7.3.280.0110.00616.53
7.3.270.0110.00717.40
7.3.260.0170.00318.24
7.3.250.0080.01016.69
7.3.240.0150.00316.52
7.3.230.0070.01016.50
7.3.210.0100.00716.77
7.3.200.0130.01019.39
7.3.190.0100.01116.73
7.3.180.0090.00616.68
7.3.170.0130.00616.56
7.3.160.0060.01016.64
7.3.120.0030.00815.20
7.2.330.0080.00816.74
7.2.320.0100.00916.94
7.2.310.0090.01216.76
7.2.300.0000.01716.95
7.2.290.0110.00616.94
7.2.60.0110.00417.20
7.2.00.0030.00919.40
7.1.200.0070.00415.90
7.1.100.0090.00618.27
7.1.70.0070.00717.31
7.1.60.0070.01719.40
7.1.50.0040.01617.26
7.1.00.0030.06722.30
7.0.200.0260.00414.59
7.0.140.0000.07722.00
7.0.60.0100.07019.82
7.0.50.0230.06017.87
7.0.40.0070.08017.74
7.0.30.0130.08317.74
7.0.20.0000.05717.77
7.0.10.0100.08017.80
7.0.00.0070.05317.82
5.6.280.0100.06721.13
5.6.210.0070.08020.51
5.6.200.0030.08318.18
5.6.190.0070.08018.16
5.6.180.0070.07718.30
5.6.170.0030.06718.15
5.6.160.0130.04018.16
5.6.150.0000.05018.14
5.6.140.0130.08018.18
5.6.130.0000.05718.23
5.6.120.0070.04018.21
5.6.110.0130.05318.24
5.6.100.0000.09018.17
5.6.90.0170.05018.17
5.6.80.0070.04317.66
5.6.70.0100.07717.53
5.6.60.0070.08017.56
5.6.50.0070.04717.68
5.6.40.0100.03317.59
5.6.30.0000.04317.55
5.6.20.0130.06717.54
5.6.10.0070.07017.59
5.6.00.0130.07017.48
5.5.350.0130.06720.44
5.5.340.0030.08717.98
5.5.330.0000.07718.03
5.5.320.0100.06017.98
5.5.310.0070.08318.09
5.5.300.0070.07718.05
5.5.290.0000.08717.98
5.5.280.0100.07318.03
5.5.270.0000.04718.08
5.5.260.0030.05317.94
5.5.250.0070.07317.82
5.5.240.0030.05017.42
5.5.230.0100.07017.33
5.5.220.0070.04017.46
5.5.210.0030.06717.33
5.5.200.0000.04717.44
5.5.190.0100.07317.33
5.5.180.0030.08017.33
5.5.160.0070.08017.45
5.5.150.0030.04017.30
5.5.140.0030.04317.30
5.5.130.0100.03317.34
5.5.120.0100.07317.39
5.5.110.0100.06317.39
5.5.100.0170.06717.18
5.5.90.0130.06717.19
5.5.80.0100.07017.18
5.5.70.0130.07017.23
5.5.60.0170.06717.27
5.5.50.0130.07317.32
5.5.40.0100.05317.20
5.5.30.0030.04317.21
5.5.20.0100.07717.18
5.5.10.0070.03717.18
5.5.00.0100.07717.28
5.4.450.0170.03719.39
5.4.440.0030.08319.22
5.4.430.0170.04719.59
5.4.420.0030.05019.37
5.4.410.0100.07319.29
5.4.400.0030.07319.05
5.4.390.0070.07719.05
5.4.380.0100.05319.05
5.4.370.0070.04319.14
5.4.360.0030.04319.03
5.4.350.0030.04019.27
5.4.340.0070.06719.27
5.4.320.0030.05719.05
5.4.310.0070.04319.03
5.4.300.0130.05319.05
5.4.290.0130.06719.27
5.4.280.0000.07719.13
5.4.270.0070.06719.10
5.4.260.0030.05019.09
5.4.250.0070.07719.26
5.4.240.0100.06019.11
5.4.230.0030.07718.88
5.4.220.0030.08019.00
5.4.210.0100.06019.03
5.4.200.0100.06019.09
5.4.190.0030.05019.04
5.4.180.0100.07719.09
5.4.170.0130.07019.11
5.4.160.0100.07718.94
5.4.150.0030.04319.11
5.4.140.0070.03716.45
5.4.130.0100.04316.29
5.4.120.0070.07316.35
5.4.110.0100.06316.29
5.4.100.0100.06316.50
5.4.90.0070.06016.50
5.4.80.0100.07316.33
5.4.70.0030.06016.36
5.4.60.0070.05716.39
5.4.50.0070.05716.40
5.4.40.0030.04716.35
5.4.30.0000.05316.55
5.4.20.0130.06016.35
5.4.10.0030.05316.55
5.4.00.0130.05715.74
5.3.290.0070.03714.71
5.3.280.0130.06014.59
5.3.270.0100.03314.63
5.3.260.0100.07314.68
5.3.250.0130.04314.65
5.3.240.0000.08014.68
5.3.230.0130.03014.62
5.3.220.0030.05314.55
5.3.210.0130.05714.63
5.3.200.0070.06314.61
5.3.190.0100.06014.52
5.3.180.0100.06714.60
5.3.170.0070.04714.78
5.3.160.0100.03714.63
5.3.150.0030.04014.61
5.3.140.0030.07714.59
5.3.130.0100.07314.61
5.3.120.0100.04314.62
5.3.110.0100.07314.61
5.3.100.0070.05714.05
5.3.90.0100.07314.08
5.3.80.0100.07014.05
5.3.70.0070.05314.05
5.3.60.0070.04314.02
5.3.50.0130.06713.93
5.3.40.0070.07314.02
5.3.30.0070.04713.96
5.3.20.0070.06713.79
5.3.10.0000.05013.69
5.3.00.0000.06313.52
5.2.170.0000.04311.04
5.2.160.0170.05011.36
5.2.150.0030.03311.13
5.2.140.0070.03011.03
5.2.130.0070.02711.07
5.2.120.0000.03711.14
5.2.110.0000.06311.00
5.2.100.0070.06011.15
5.2.90.0070.06311.00
5.2.80.0100.04311.30
5.2.70.0070.06711.18
5.2.60.0030.03711.09
5.2.50.0070.02711.02
5.2.40.0000.06310.98
5.2.30.0030.04310.87
5.2.20.0100.05710.93
5.2.10.0070.03010.93
5.2.00.0100.05310.63
5.1.60.0000.0479.84
5.1.50.0030.0279.96
5.1.40.0030.0509.82
5.1.30.0100.04710.20
5.1.20.0030.04010.26
5.1.10.0000.03710.07
5.1.00.0070.02710.02
5.0.50.0030.0378.64
5.0.40.0070.0278.41
5.0.30.0030.0408.16
5.0.20.0070.0308.28
5.0.10.0070.0308.16
5.0.00.0000.0438.38
4.4.90.0070.0177.84
4.4.80.0000.0177.84
4.4.70.0030.0337.84
4.4.60.0000.0337.84
4.4.50.0070.0337.84
4.4.40.0000.0437.84
4.4.30.0000.0177.84
4.4.20.0000.0207.84
4.4.10.0000.0177.84
4.4.00.0030.0477.84
4.3.110.0030.0307.84
4.3.100.0100.0137.84
4.3.90.0070.0307.84
4.3.80.0000.0537.84
4.3.70.0070.0307.84
4.3.60.0030.0307.84
4.3.50.0070.0307.84
4.3.40.0070.0477.84
4.3.30.0000.0377.84
4.3.20.0000.0377.84
4.3.10.0030.0377.84
4.3.00.0000.0237.84

preferences:
45.67 ms | 404 KiB | 6 Q