3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<_HTML <!doctype html><html><head><title>What</title></head><body><p>(what)</p><div id="main"><p><span>what?</span></p><ul><li><span>foo</span> what!</li><li>(what?)</li></ul></div><p>(what)</p></body></html> _HTML; $find = ['(', ')', '?', '!']; $replace = ['(&#8202;', '&#8202;)', '&#8202;?', '&#8202;!']; $selector = implode(' or ', array_map(function($char) { return sprintf('contains(text(), "%s")', $char); }, $find)); $query = sprintf('//div[@id="main"]//*[%s]/text()', $selector); $doc = new DOMDocument(); $doc->loadHTML($content); $xpath = new DOMXPath($doc); $elements = $xpath->query($query); foreach ($elements as $element) { $element->nodeValue = html_entity_decode(str_replace($find, $replace, $element->nodeValue)); } echo $doc->saveHTML();

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.0140.00818.14
8.4.130.0100.01118.38
8.4.120.0100.00821.24
8.4.110.0100.01022.81
8.4.100.0050.00518.38
8.4.90.0080.01319.19
8.4.80.0100.01119.43
8.4.70.0040.00418.42
8.4.60.0120.00921.31
8.4.50.0130.00720.94
8.4.40.0060.00319.29
8.4.30.0030.01320.86
8.4.20.0060.01519.95
8.4.10.0000.00822.85
8.3.270.0120.00817.20
8.3.260.0120.00717.15
8.3.250.0110.00819.44
8.3.240.0100.00917.58
8.3.230.0150.00217.15
8.3.220.0090.00919.33
8.3.210.0080.00717.39
8.3.200.0070.00317.04
8.3.190.0040.00419.66
8.3.180.0050.00416.98
8.3.170.0130.00621.23
8.3.160.0070.00317.73
8.3.150.0120.00617.73
8.3.140.0030.00617.33
8.3.130.0060.00317.15
8.3.120.0090.00021.46
8.3.110.0030.01217.31
8.3.100.0070.00417.41
8.3.90.0000.00926.77
8.3.80.0000.00919.36
8.3.70.0200.00317.13
8.3.60.0140.00716.88
8.3.50.0140.00623.85
8.3.40.0100.00619.96
8.3.30.0140.00719.29
8.3.20.0090.00024.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0040.00520.77
8.2.280.0060.00318.68
8.2.270.0070.01117.53
8.2.260.0050.00317.13
8.2.250.0080.00017.02
8.2.240.0100.00017.57
8.2.230.0090.00020.94
8.2.220.0130.00024.06
8.2.210.0030.00626.77
8.2.200.0050.00518.88
8.2.190.0070.01018.66
8.2.180.0090.00925.92
8.2.170.0030.01422.96
8.2.160.0040.01122.96
8.2.150.0030.00525.66
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0090.00020.29
8.2.110.0070.00320.83
8.2.100.0090.00317.97
8.2.90.0030.00718.25
8.2.80.0030.00619.28
8.2.70.0030.00618.02
8.2.60.0030.00618.41
8.2.50.0000.00819.70
8.2.40.0030.00521.36
8.2.30.0040.00419.66
8.2.20.0000.00818.63
8.2.10.0040.00419.64
8.2.00.0040.00419.65
8.1.330.0120.00722.38
8.1.320.0110.00916.37
8.1.310.0020.00516.92
8.1.300.0040.01118.86
8.1.290.0000.00930.84
8.1.280.0110.00425.92
8.1.270.0050.00323.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00622.58
8.1.230.0060.00621.44
8.1.220.0040.00418.29
8.1.210.0000.00918.77
8.1.200.0090.00017.73
8.1.190.0050.00317.73
8.1.180.0050.00319.54
8.1.170.0040.00419.02
8.1.160.0000.00819.25
8.1.150.0000.00719.20
8.1.140.0000.00819.32
8.1.130.0030.00320.56
8.1.120.0040.00417.77
8.1.110.0000.00717.82
8.1.100.0030.00717.77
8.1.90.0000.00917.72
8.1.80.0070.00017.87
8.1.70.0030.00717.79
8.1.60.0000.00817.87
8.1.50.0000.00817.86
8.1.40.0040.00417.95
8.1.30.0040.00417.98
8.1.20.0040.00418.04
8.1.10.0040.00417.98
8.1.00.0000.00917.84
8.0.300.0060.00318.77
8.0.290.0080.00017.25
8.0.280.0080.00018.69
8.0.270.0030.00317.28
8.0.260.0030.00318.85
8.0.250.0040.00417.39
8.0.240.0030.00317.40
8.0.230.0040.00417.39
8.0.220.0030.00317.39
8.0.210.0040.00417.35
8.0.200.0070.00017.23
8.0.190.0020.00517.28
8.0.180.0030.00617.27
8.0.170.0000.00817.41
8.0.160.0040.00417.35
8.0.150.0000.00717.25
8.0.140.0060.00317.13
8.0.130.0060.00013.76
8.0.120.0000.00717.29
8.0.110.0050.00217.32
8.0.100.0070.00017.38
8.0.90.0000.00917.21
8.0.80.0050.01217.35
8.0.70.0020.00517.14
8.0.60.0040.00417.07
8.0.50.0040.00417.10
8.0.30.0060.01517.76
8.0.20.0090.00817.51
8.0.10.0130.00617.55
8.0.00.0130.00317.25
7.4.330.0050.00015.55
7.4.320.0070.00016.86
7.4.300.0030.00316.86
7.4.290.0030.00316.89
7.4.280.0050.00316.86
7.4.270.0020.00516.88
7.4.260.0060.00013.78
7.4.250.0040.00416.90
7.4.240.0040.00316.98
7.4.230.0000.00817.11
7.4.220.0040.00416.81
7.4.210.0080.01216.94
7.4.200.0070.00016.93
7.4.160.0130.00416.62
7.4.150.0170.00416.68
7.4.140.0110.00416.66
7.4.130.0090.01016.84
7.4.120.0060.01116.73
7.4.110.0100.00816.76
7.4.100.0120.01016.82
7.4.90.0110.00716.71
7.4.80.0050.01018.04
7.4.70.0050.01216.87
7.4.60.0140.00316.79
7.4.50.0080.01316.82
7.4.40.0120.00716.86
7.4.30.0090.00916.60
7.4.20.0170.00316.76
7.4.10.0100.00916.77
7.4.00.0080.01016.81
7.3.330.0040.00416.68
7.3.320.0060.00013.66
7.3.310.0000.00816.72
7.3.300.0040.00216.60
7.3.290.0070.00716.68
7.3.280.0120.00416.66
7.3.270.0000.01516.76
7.3.260.0060.01316.76
7.3.250.0060.01216.88
7.3.240.0070.01016.74
7.3.230.0080.01016.76
7.3.220.0100.01016.77
7.3.210.0050.01116.80
7.3.200.0120.00516.78
7.3.190.0090.00916.77
7.3.180.0060.00816.74
7.3.170.0080.01116.64
7.3.160.0080.01316.66
7.3.150.0120.00516.77
7.3.140.0060.01416.78
7.3.130.0080.00916.84
7.3.120.0110.00916.80
7.3.110.0130.00816.69
7.3.100.0070.01116.70
7.3.90.0150.00216.73
7.3.80.0090.00916.72
7.3.70.0090.00816.77
7.3.60.0080.00716.69
7.3.50.0100.00916.54
7.3.40.0100.00816.58
7.3.30.0150.00816.70
7.3.20.0120.01416.72
7.3.10.0120.01216.80
7.3.00.0110.00716.73
7.2.340.0210.01017.23
7.2.330.0200.00817.11
7.2.320.0140.01117.25
7.2.310.0140.01017.21
7.2.300.0160.00917.22
7.2.290.0180.00916.97
7.2.280.0170.01117.02
7.2.270.0180.01016.97
7.2.260.0140.01317.06
7.2.250.0140.01216.98
7.2.240.0110.01516.88
7.2.230.0180.00916.98
7.2.220.0130.01317.09
7.2.210.0170.00917.04
7.2.200.0140.01216.93
7.2.190.0180.00616.87
7.2.180.0170.00916.88
7.2.170.0120.01317.02
7.2.160.0210.00916.96
7.2.150.0190.00816.96
7.2.140.0160.01117.14
7.2.130.0170.01317.02
7.2.120.0150.01617.07
7.2.110.0150.00916.94
7.2.100.0150.01217.02
7.2.90.0120.01517.06
7.2.80.0210.00916.89
7.2.70.0160.00916.98
7.2.60.0100.01816.83
7.2.50.0180.01116.97
7.2.40.0310.01116.86
7.2.30.0080.01516.90
7.2.20.0150.01017.05
7.2.10.0160.01216.86
7.2.00.0120.01517.02

preferences:
38.12 ms | 403 KiB | 5 Q