3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keywords = [ 'keywords' => 'www.1.com', 'hello' => 'www.2.com', 'there' => 'www.3.com', 'are' => 'www.4.com', ]; $sentence = ' <div> <h1>Hello</h1> <h2>Hello there blablabla</h2> <p>Hello, there are keywords</p> <p>Hello, there are keywords</p> <p>Hello, there are keywords</p> <p>Hello, there are keywords</p> <p>Hello, there are keywords</p> </div>'; $dom = new DOMDocument; $dom->loadHTML($sentence, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); foreach ($dom->getElementsByTagName('p') as $p) { $p->nodeValue = preg_replace_callback( '~\b(?:' . implode('|', array_keys($keywords)) . ')\b~i', function($m) use ($keywords) { return $keywords[strtolower($m[0])]; }, $p->nodeValue ); } echo $dom->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.5.10.0110.00617.20
8.5.00.0130.00920.36
8.4.160.0160.00620.21
8.4.150.0010.00114.05
8.4.140.0200.01318.02
8.4.130.0150.00518.16
8.4.120.0070.00622.78
8.4.110.0110.00919.11
8.4.100.0130.00718.28
8.4.90.0120.01022.47
8.4.80.0080.01119.04
8.4.70.0130.00720.84
8.4.60.0060.00320.89
8.4.50.0130.00718.22
8.4.40.0130.00718.18
8.4.30.0100.01020.55
8.4.20.0100.01018.04
8.4.10.0090.00025.94
8.3.280.0110.00818.94
8.3.270.0110.00917.13
8.3.260.0110.00717.18
8.3.250.0140.00619.21
8.3.240.0100.01016.91
8.3.230.0140.00617.15
8.3.220.0040.00419.15
8.3.210.0140.00717.06
8.3.200.0050.00417.23
8.3.190.0110.00717.50
8.3.180.0120.00816.80
8.3.170.0090.00917.34
8.3.160.0070.01119.09
8.3.150.0000.01917.50
8.3.140.0060.00317.27
8.3.130.0040.00417.16
8.3.120.0090.00019.23
8.3.110.0070.01320.94
8.3.100.0060.00324.06
8.3.90.0030.00626.77
8.3.80.0040.00717.13
8.3.70.0070.00718.80
8.3.60.0070.01118.81
8.3.50.0120.00924.64
8.3.40.0060.01319.34
8.3.30.0040.01119.20
8.3.20.0000.00824.18
8.3.10.0050.00324.66
8.3.00.0040.00426.16
8.2.290.0100.00916.75
8.2.280.0120.00618.92
8.2.270.0130.00718.68
8.2.260.0060.00319.22
8.2.250.0090.00017.02
8.2.240.0160.00319.16
8.2.230.0030.00622.58
8.2.220.0070.00337.54
8.2.210.0060.00326.77
8.2.200.0060.00316.88
8.2.190.0180.00617.00
8.2.180.0110.00725.92
8.2.170.0120.00919.41
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00026.35
8.2.110.0000.00921.16
8.2.100.0060.00718.06
8.2.90.0000.00819.64
8.2.80.0050.00317.97
8.2.70.0030.00618.28
8.2.60.0060.00518.40
8.2.50.0060.00318.10
8.2.40.0050.00321.32
8.2.30.0080.00019.54
8.2.20.0030.00518.33
8.2.10.0040.00419.62
8.2.00.0060.00319.49
8.1.330.0140.00516.70
8.1.320.0100.00818.12
8.1.310.0040.01218.71
8.1.300.0080.00018.70
8.1.290.0030.00618.88
8.1.280.0040.01125.92
8.1.270.0040.00424.04
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0060.00324.09
8.1.230.0080.00418.08
8.1.220.0000.00818.14
8.1.210.0000.00818.77
8.1.200.0030.00817.86
8.1.190.0060.00317.86
8.1.180.0040.00418.10
8.1.170.0000.00819.20
8.1.160.0050.00219.11
8.1.150.0000.00719.12
8.1.140.0000.00819.03
8.1.130.0100.00020.40
8.1.120.0000.00717.95
8.1.110.0000.00917.97
8.1.100.0040.00417.89
8.1.90.0000.00717.88
8.1.80.0030.00517.94
8.1.70.0000.00717.88
8.1.60.0030.00618.09
8.1.50.0030.00617.81
8.1.40.0040.00417.83
8.1.30.0060.00318.09
8.1.20.0080.00018.02
8.1.10.0000.00817.96
8.1.00.0030.00517.88
8.0.300.0040.00418.77
8.0.290.0090.00017.25
8.0.280.0040.00418.78
8.0.270.0050.00317.29
8.0.260.0000.00718.79
8.0.250.0040.00417.38
8.0.240.0070.00017.31
8.0.230.0090.00017.37
8.0.220.0000.00717.23
8.0.210.0070.00017.24
8.0.200.0040.00417.30
8.0.190.0050.00317.28
8.0.180.0000.00717.30
8.0.170.0040.00417.28
8.0.160.0030.00617.22
8.0.150.0030.00517.22
8.0.140.0000.00717.17
8.0.130.0060.00013.75
8.0.120.0000.00817.24
8.0.110.0030.00517.18
8.0.100.0050.00217.28
8.0.90.0020.00517.46
8.0.80.0060.01117.18
8.0.70.0020.00517.11
8.0.60.0050.00217.32
8.0.50.0030.00517.28
8.0.30.0140.00317.57
8.0.20.0070.02317.69
8.0.10.0170.01717.66
8.0.00.0150.01617.40
7.4.330.0000.00515.55
7.4.320.0030.00316.96
7.4.300.0070.00016.91
7.4.290.0060.00316.99
7.4.280.0000.00817.00
7.4.270.0000.00716.97
7.4.260.0030.00313.64
7.4.250.0040.00417.00
7.4.240.0020.00517.13
7.4.230.0000.00916.95
7.4.220.0020.00617.15
7.4.210.0120.00617.04
7.4.200.0040.00417.20
7.4.150.0300.02017.40
7.4.140.0330.01717.40
7.4.130.0180.00817.40
7.4.120.0090.01317.40
7.4.110.0280.01817.40
7.4.100.0170.00817.40
7.4.90.0260.00617.40
7.4.80.0210.00417.40
7.4.70.0150.01517.40
7.4.60.0350.00317.40
7.4.50.0110.01517.40
7.4.40.0190.00717.40
7.4.30.0100.01417.40
7.4.20.0150.01117.40
7.4.10.0200.00317.40
7.4.00.0120.00617.40
7.3.330.0080.00016.71
7.3.320.0000.00613.71
7.3.310.0030.00316.75
7.3.300.0000.00616.77
7.3.290.0090.00716.71
7.3.270.0250.00917.40
7.3.260.0310.01117.40
7.3.250.0100.01317.40
7.3.240.0120.00917.40
7.3.230.0070.02017.40
7.3.220.0300.01517.40
7.3.210.0100.01617.40
7.3.200.0110.01117.40
7.3.190.0130.01017.40
7.3.180.0110.01517.40
7.3.170.0130.01317.40
7.3.160.0040.01817.40
7.3.150.0080.01517.40
7.3.140.0110.01717.40
7.3.130.0190.00317.40
7.3.120.0110.01117.40
7.3.110.0130.02417.40
7.3.100.0170.00417.40
7.3.90.0210.00417.40
7.3.80.0190.00517.40
7.3.70.0200.00717.40
7.3.60.0140.00717.40
7.3.50.0110.01417.40
7.3.40.0150.00617.40
7.3.30.0070.01417.40
7.3.20.0130.00917.40
7.3.10.0160.00517.40
7.3.00.0140.00817.40

preferences:
46.64 ms | 403 KiB | 5 Q