3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <body> <img src="http://example/img/product/name/thumbs/100/img.jpg" alt="lol" width="100" height="100" caption="false" class="popup-img left" /> </body> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); $xpath = new DOMXPath($dom); $nodes = $xpath->query('//img[contains(@class, "popup-img")]'); foreach($nodes as $node) { $a = $dom->createElement('a'); $a->setAttribute('class', $node->getAttribute("class")); $a->setAttribute('title', $node->getAttribute("alt")); $href = parse_url($node->getAttribute("src"), PHP_URL_PATH); $a->setAttribute('href', '..' . str_replace('/thumbs/100/', '/', $href)); $a->setAttribute('style', "background: url('..$href'); -webkit-background-size:cover; background-size:cover;"); $node->parentNode->insertBefore($a, $node); $node->parentNode->removeChild($node); } 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.1.70.0000.00717.86
8.1.60.0000.01117.89
8.1.50.0080.00017.88
8.1.40.0060.00617.81
8.1.30.0000.00817.95
8.1.20.0030.00617.84
8.1.10.0080.00417.84
8.1.00.0030.00517.84
8.0.200.0070.00017.32
8.0.190.0000.00817.25
8.0.180.0080.00017.37
8.0.170.0030.00617.37
8.0.160.0080.00017.33
8.0.150.0000.00717.24
8.0.140.0060.00317.16
8.0.130.0000.00513.75
8.0.120.0040.00417.32
8.0.110.0050.00317.24
8.0.100.0050.00317.33
8.0.90.0060.00317.31
8.0.80.0160.00617.38
8.0.70.0000.00817.46
8.0.60.0040.00417.16
8.0.50.0000.00817.26
8.0.30.0090.00917.50
8.0.20.0090.01117.39
8.0.10.0030.00517.43
8.0.00.0120.01317.33
7.4.300.0070.00016.92
7.4.290.0000.00716.87
7.4.280.0000.00816.85
7.4.270.0070.00016.94
7.4.260.0030.00313.66
7.4.250.0000.00816.79
7.4.240.0020.00516.97
7.4.230.0030.00317.10
7.4.220.0030.00316.90
7.4.210.0050.01416.85
7.4.200.0040.00416.71
7.4.130.0100.01116.81
7.4.120.0070.01016.86
7.4.110.0060.01217.00
7.4.100.0090.01017.06
7.4.90.0080.01216.86
7.4.80.0100.01319.39
7.4.70.0100.00716.81
7.4.60.0090.00916.85
7.4.50.0090.00916.96
7.4.40.0320.00816.85
7.4.30.0150.01916.74
7.4.20.0330.00616.75
7.4.10.0260.00716.68
7.4.00.0120.00616.73
7.3.330.0040.00416.81
7.3.320.0030.00313.59
7.3.310.0030.00316.89
7.3.300.0000.00716.65
7.3.290.0070.01016.75
7.3.260.0000.02216.95
7.3.240.0110.00616.92
7.3.230.0090.00916.87
7.3.210.0090.00916.63
7.3.200.0090.00916.74
7.3.190.0140.00316.85
7.3.180.0120.00416.76
7.3.170.0160.00316.79
7.3.160.0340.00716.84
7.3.150.0280.00416.77
7.3.140.0200.01416.77
7.3.130.0270.00716.70
7.3.120.0230.01016.68
7.3.110.0270.00616.53
7.3.100.0280.00616.75
7.3.90.0200.01616.90
7.3.80.0270.01216.86
7.3.70.0280.01116.93
7.3.60.0220.01816.72
7.3.50.0180.01516.87
7.3.40.0280.00616.71
7.3.30.0210.01216.67
7.3.20.0150.02016.83
7.3.10.0180.01416.75
7.3.00.0310.01216.81
7.2.330.0160.00317.20
7.2.320.0100.00717.20
7.2.310.0150.00916.90
7.2.300.0150.00617.08
7.2.290.0370.00516.91
7.2.280.0270.01116.73
7.2.270.0190.01316.75
7.2.260.0260.01117.09
7.2.250.0210.00817.05
7.2.240.0250.01417.13
7.2.230.0310.00717.16
7.2.220.0210.01816.93
7.2.210.0290.01117.24
7.2.200.0350.00917.02
7.2.190.0260.01016.91
7.2.180.0310.00917.03
7.2.170.0240.01017.06
7.2.160.0230.01317.01
7.2.150.0240.01217.07
7.2.140.0660.01017.10
7.2.130.0190.01616.91
7.2.120.0240.01117.05
7.2.110.0210.00717.03
7.2.100.0120.01516.75
7.2.90.0080.01716.68
7.2.80.0200.01416.94
7.2.70.0350.00717.03
7.2.60.0290.00916.93
7.2.50.0220.01517.10
7.2.40.0240.01717.05
7.2.30.0260.01816.87
7.2.20.0250.01516.81
7.2.10.0330.00316.89
7.2.00.0090.01216.80

preferences:
11.72 ms | 406 KiB | 5 Q