3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<p> The <b>Sarcopterygii</b> or <b>lobe-finned fish</b> (from Greek σαρξ <i>sarx</i>, flesh, and πτερυξ <i>pteryx</i>, fin) – sometimes considered synonymous with <b>Crossopterygii</b> ("fringe-f(i)nned fish", from Greek κροσσός <i>krossos</i>, fringe) – constitute a <a href="/wiki/Clade" title="Clade">clade</a> (traditionally a <a href="/wiki/Class_(biology)" title="Class (biology)">class</a> or subclass) of the <a href="/wiki/Osteichthyes" title="Osteichthyes">bony fish</a>, though a strict <a href="/wiki/Cladistic" class="mw-redirect" title="Cladistic">cladistic</a> view includes the terrestrial <a href="/wiki/Vertebrate" title="Vertebrate">vertebrates</a>. </p>'; $occurrences = 0; $replacements = []; $replacedString = preg_replace_callback("/<a .*?>.*?<\/a>/i", function($el) use (&$occurrences, &$replacements) { $replacements["|||".$occurrences] = $el[0]; // the ||| are just to avoid unwanted matches return "|||".$occurrences++; }, $string); function removeParentheses( $content ) { $pattern = '@\(([^()]|(?R))*\)@'; $content = preg_replace( $pattern, '', $content ); $content = str_replace( ' .', '.', $content ); $content = str_replace( ' ', ' ', $content ); return $content; } $replacedString = removeParentheses($replacedString); $replacedString = str_replace(array_keys($replacements), array_values($replacements), $replacedString); echo $replacedString;

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.4.140.0110.01117.80
8.4.130.0150.00618.02
8.4.120.0120.00820.56
8.4.110.0050.00520.98
8.4.100.0080.00819.00
8.4.90.0140.00720.69
8.4.80.0030.00618.83
8.4.70.0120.00819.07
8.4.60.0030.00618.82
8.4.50.0110.00917.98
8.4.40.0040.00417.84
8.4.30.0060.01317.95
8.4.20.0100.01019.93
8.4.10.0090.00319.41
8.3.270.0100.01016.74
8.3.260.0050.00416.74
8.3.250.0080.01117.30
8.3.240.0120.00716.92
8.3.230.0130.00616.54
8.3.220.0120.00719.39
8.3.210.0100.00918.47
8.3.200.0060.00516.98
8.3.190.0080.00317.14
8.3.180.0080.00616.75
8.3.170.0140.00016.78
8.3.160.0090.00916.67
8.3.150.0050.00317.27
8.3.140.0080.00016.71
8.3.130.0040.00418.81
8.3.120.0060.00320.91
8.3.110.0050.00520.94
8.3.100.0030.01024.06
8.3.90.0040.00426.77
8.3.80.0040.00416.88
8.3.70.0070.00716.88
8.3.60.0040.01517.00
8.3.50.0100.00818.54
8.3.40.0160.00018.95
8.3.30.0130.00318.96
8.3.20.0080.00020.33
8.3.10.0060.00322.09
8.3.00.0040.00423.53
8.2.290.0110.00822.13
8.2.280.0100.00818.42
8.2.270.0090.00917.01
8.2.260.0040.00419.23
8.2.250.0090.00618.59
8.2.240.0080.00018.93
8.2.230.0040.00422.58
8.2.220.0090.00037.54
8.2.210.0080.00026.77
8.2.200.0000.00917.00
8.2.190.0110.00416.88
8.2.180.0070.01416.63
8.2.170.0070.00722.96
8.2.160.0090.00620.38
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0080.00022.19
8.2.120.0070.00026.35
8.2.110.0040.00421.16
8.2.100.0040.00818.03
8.2.90.0000.00819.17
8.2.80.0030.00717.97
8.2.70.0000.00817.63
8.2.60.0080.00017.93
8.2.50.0040.00418.10
8.2.40.0000.00720.61
8.2.30.0000.00719.26
8.2.20.0000.00718.05
8.2.10.0030.00618.23
8.2.00.0090.00018.07
8.1.330.0110.00822.19
8.1.320.0070.01216.61
8.1.310.0030.00616.86
8.1.300.0030.00617.98
8.1.290.0030.00618.88
8.1.280.0070.00725.92
8.1.270.0100.00023.99
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0060.01621.27
8.1.230.0080.00417.83
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0000.00917.60
8.1.190.0040.00417.38
8.1.180.0000.00818.10
8.1.170.0030.00618.76
8.1.160.0000.00818.92
8.1.150.0040.00420.19
8.1.140.0070.00017.57
8.1.130.0000.00719.09
8.1.120.0000.00717.69
8.1.110.0000.00817.52
8.1.100.0050.00317.61
8.1.90.0040.00417.54
8.1.80.0080.00317.62
8.1.70.0030.00317.54
8.1.60.0000.00817.79
8.1.50.0030.00517.72
8.1.40.0030.00617.73
8.1.30.0030.00617.83
8.1.20.0050.00317.82
8.1.10.0040.00417.79
8.1.00.0040.00417.71
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0060.00318.52
8.0.270.0000.00717.27
8.0.260.0000.00718.54
8.0.250.0000.00717.13
8.0.240.0040.00417.11
8.0.230.0050.00317.10
8.0.220.0030.00317.10
8.0.210.0030.00317.13
8.0.200.0030.00317.16
8.0.190.0030.00517.13
8.0.180.0030.00517.00
8.0.170.0040.00417.17
8.0.160.0000.00817.06
8.0.150.0050.00216.96
8.0.140.0000.00716.96
8.0.130.0000.00613.54
8.0.120.0080.00017.10
8.0.110.0030.00516.90
8.0.100.0040.00417.11
8.0.90.0070.00016.93
8.0.80.0150.00617.14
8.0.70.0000.00716.96
8.0.60.0000.00816.94
8.0.50.0040.00416.95
8.0.30.0120.00817.20
8.0.20.0080.01317.44
8.0.10.0030.00517.10
8.0.00.0070.01117.01
7.4.330.0000.00515.55
7.4.320.0030.00316.72
7.4.300.0000.00716.82
7.4.290.0050.00216.73
7.4.280.0050.00316.79
7.4.270.0000.00716.86
7.4.260.0000.00716.68
7.4.250.0030.00416.75
7.4.240.0000.00716.88
7.4.230.0000.00716.77
7.4.220.0060.01316.83
7.4.210.0040.01116.73
7.4.200.0000.00716.66
7.4.160.0100.00716.69
7.4.150.0110.00817.40
7.4.140.0100.00917.86
7.4.130.0030.01616.71
7.4.120.0100.00816.77
7.4.110.0160.00716.93
7.4.100.0060.01016.73
7.4.90.0070.01016.55
7.4.80.0110.00719.39
7.4.70.0160.00716.63
7.4.60.0030.01416.66
7.4.50.0030.00816.70
7.4.40.0030.01316.75
7.4.30.0060.01516.85
7.4.10.0090.01015.14
7.4.00.0050.01315.23
7.3.330.0020.00213.59
7.3.320.0000.00613.50
7.3.310.0070.00016.41
7.3.300.0000.00716.53
7.3.290.0100.00816.55
7.3.280.0070.01016.54
7.3.270.0190.00017.40
7.3.260.0120.01216.59
7.3.250.0120.01016.73
7.3.240.0070.01016.76
7.3.230.0040.01216.61
7.3.210.0120.00316.56
7.3.200.0080.00916.46
7.3.190.0070.01016.80
7.3.180.0070.01016.75
7.3.170.0070.01016.56
7.3.160.0130.00316.63
7.3.130.0070.01015.19
7.3.120.0070.01115.05
7.3.110.0110.00815.10
7.3.100.0060.00915.04
7.3.90.0050.00915.03
7.3.80.0070.00614.86
7.3.70.0070.00515.20
7.3.60.0080.00814.88
7.3.50.0050.00514.93
7.3.40.0070.00614.87
7.3.30.0080.00715.14
7.3.20.0110.00316.77
7.3.10.0020.00816.88
7.3.00.0080.00717.04
7.2.330.0090.00916.75
7.2.320.0090.00916.90
7.2.310.0100.00716.93
7.2.300.0030.01317.05
7.2.290.0090.01316.72
7.2.260.0130.00715.37
7.2.250.0090.00915.30
7.2.240.0080.00815.40
7.2.230.0040.00915.23
7.2.220.0080.00715.28
7.2.210.0040.00915.39
7.2.200.0100.00615.18
7.2.190.0070.00615.29
7.2.180.0030.00815.30
7.2.170.0050.00615.32
7.2.160.0040.00715.35
7.2.150.0030.01016.96
7.2.140.0060.00317.25
7.2.130.0070.01117.18
7.2.120.0030.01017.06
7.2.110.0090.00016.77
7.2.100.0070.00717.32
7.2.90.0070.00716.86
7.2.80.0030.01017.17
7.2.70.0130.00016.90
7.2.60.0080.00817.08
7.2.50.0080.00517.05
7.2.40.0040.00717.30
7.2.30.0090.00617.20
7.2.20.0030.00716.86
7.2.10.0090.00617.21
7.2.00.0070.01117.27
7.1.330.0060.00916.08
7.1.320.0040.00816.01
7.1.310.0040.01215.91
7.1.300.0030.00715.92
7.1.290.0060.00616.05
7.1.280.0020.01016.04
7.1.270.0030.01116.05
7.1.260.0020.01215.97
7.1.250.0120.00015.91
7.1.240.0030.00615.88
7.1.230.0000.01415.80
7.1.220.0100.00716.10
7.1.210.0070.00715.96
7.1.200.0080.00416.09
7.1.190.0110.00416.21
7.1.180.0090.00016.09
7.1.170.0000.01015.80
7.1.160.0060.00616.17
7.1.150.0030.01015.90
7.1.140.0000.00815.84
7.1.130.0030.01115.99
7.1.120.0070.00716.19
7.1.110.0040.00715.81
7.1.100.1100.01016.12
7.1.90.0090.01216.07
7.1.80.0100.00816.14
7.1.70.0090.00715.85
7.1.60.0330.00324.58
7.1.50.0180.00824.44
7.1.40.0120.01424.20
7.1.30.0180.00924.22
7.1.20.0150.01624.26
7.1.10.0170.00615.62
7.1.00.0100.00315.41
7.0.330.0070.00715.68
7.0.320.0060.00615.55
7.0.310.0000.00815.49
7.0.300.0030.00915.47
7.0.290.0000.01115.48
7.0.280.0000.01215.54
7.0.270.0090.00415.42
7.0.260.0050.00315.57
7.0.250.0030.01015.69
7.0.240.1130.00415.75
7.0.230.0110.00915.89
7.0.220.0090.00915.75
7.0.210.0060.00615.44
7.0.200.0070.00915.33
7.0.190.0090.01415.39
7.0.180.0130.00915.11
7.0.170.0110.00915.37
7.0.160.0130.00715.28
7.0.150.0090.00815.22
7.0.140.0100.00615.24
7.0.130.2580.00915.29
7.0.120.0240.00915.24
7.0.110.0070.00915.25
7.0.100.0050.01115.00
7.0.90.0110.01015.14
7.0.80.0300.01215.36
7.0.70.0110.00815.27
7.0.60.0590.00615.11
7.0.50.0120.00815.16
7.0.40.0080.01014.36
7.0.30.0070.01214.35
7.0.20.0090.00814.25
7.0.10.0070.00914.35
7.0.00.0100.00514.20
5.6.400.0000.01315.06
5.6.390.0070.00714.54
5.6.380.0070.00314.54
5.6.370.0040.01114.70
5.6.360.0110.00314.96
5.6.350.0120.00014.61
5.6.340.0070.00714.56
5.6.330.0120.00614.70
5.6.320.0100.00314.88
5.6.310.0030.01014.85
5.6.300.0030.00914.52
5.6.290.0040.00814.43
5.6.280.0060.00315.01
5.6.270.0080.00414.57
5.6.260.0060.00614.72
5.6.250.0040.00814.30
5.6.240.0040.00814.91
5.6.230.0030.00614.92
5.6.220.0110.00314.82
5.6.210.0100.00314.55
5.6.200.0030.01014.56
5.6.190.0060.00614.60
5.6.180.0030.01314.64
5.6.170.0040.01214.56
5.6.160.0110.00414.63
5.6.150.0000.01314.84
5.6.140.0100.00314.39
5.6.130.0100.00314.73
5.6.120.0100.00314.66
5.6.110.0130.00314.66
5.6.100.0000.01614.52
5.6.90.0030.01014.66
5.6.80.0090.00614.20
5.6.70.0030.01014.66
5.6.60.0060.00314.46
5.6.50.0030.01014.83
5.6.40.0070.00714.47
5.6.30.0040.01114.46
5.6.20.0080.00414.45
5.6.10.0090.00614.19
5.6.00.0070.00714.54

preferences:
31.39 ms | 403 KiB | 5 Q