3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div class="image"> <img src="https://www.gravatar.com/avatar/" alt="test" width="50" height="50"> </div> HTML; $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); // using a loop in case there are multiple occurrences foreach ($xpath->query("//div[contains(@class, 'image')]/img") as $node) { $node->setAttribute('data-mfp-src', $node->getAttribute('src')); } 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.3.70.0070.01316.75
8.3.60.0090.00618.80
8.3.50.0120.00618.77
8.3.40.0090.00619.09
8.3.30.0090.00619.22
8.3.20.0080.00018.96
8.3.10.0040.00423.83
8.3.00.0000.00722.10
8.2.190.0130.00318.61
8.2.180.0070.01416.88
8.2.170.0160.00022.96
8.2.160.0140.00019.77
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0050.00320.14
8.2.120.0030.00626.35
8.2.110.0030.00720.69
8.2.100.0040.00818.16
8.2.90.0000.00818.03
8.2.80.0050.00318.30
8.2.70.0070.00318.28
8.2.60.0040.00418.41
8.2.50.0030.00618.10
8.2.40.0040.00419.55
8.2.30.0000.00721.00
8.2.20.0040.00418.48
8.2.10.0040.00418.39
8.2.00.0000.00819.82
8.1.280.0070.00725.92
8.1.270.0130.00324.35
8.1.260.0060.00326.35
8.1.250.0000.00728.09
8.1.240.0070.00719.51
8.1.230.0050.00521.23
8.1.220.0000.00818.13
8.1.210.0050.00318.77
8.1.200.0030.00617.60
8.1.190.0000.00817.48
8.1.180.0080.00018.10
8.1.170.0000.00818.93
8.1.160.0000.00719.27
8.1.150.0040.00419.13
8.1.140.0000.00721.09
8.1.130.0040.00417.79
8.1.120.0000.00717.82
8.1.110.0070.00017.68
8.1.100.0030.00617.71
8.1.90.0040.00417.83
8.1.80.0000.00717.84
8.1.70.0000.00717.74
8.1.60.0080.00017.82
8.1.50.0050.00217.84
8.1.40.0000.00817.86
8.1.30.0000.00817.91
8.1.20.0030.00517.90
8.1.10.0000.00717.88
8.1.00.0040.00417.86
8.0.300.0040.00421.83
8.0.290.0030.00517.00
8.0.280.0000.00718.79
8.0.270.0050.00317.45
8.0.260.0030.00317.19
8.0.250.0070.00017.35
8.0.240.0060.00317.27
8.0.230.0030.00317.30
8.0.220.0000.00717.20
8.0.210.0040.00417.20
8.0.200.0030.00317.35
8.0.190.0030.00517.25
8.0.180.0030.00517.21
8.0.170.0050.00417.20
8.0.160.0000.00817.29
8.0.150.0040.00717.32
8.0.140.0080.00017.11
8.0.130.0060.00013.66
8.0.120.0070.00017.16
8.0.110.0050.00217.31
8.0.100.0040.00417.19
8.0.90.0030.00517.19
8.0.80.0060.01217.36
8.0.70.0040.00417.30
8.0.60.0040.00417.14
8.0.50.0000.00717.29
8.0.30.0100.00817.40
8.0.20.0130.00817.43
8.0.10.0050.00317.42
8.0.00.0100.00917.13
7.4.330.0050.00015.55
7.4.320.0030.00316.97
7.4.300.0040.00416.82
7.4.290.0040.00416.90
7.4.280.0040.00416.81
7.4.270.0030.00316.95
7.4.260.0000.00716.75
7.4.250.0000.00816.86
7.4.240.0040.00416.95
7.4.230.0040.00416.87
7.4.220.0000.00816.83
7.4.210.0050.01216.92
7.4.200.0050.00216.85
7.4.160.0110.00616.86
7.4.140.0090.01017.86
7.4.130.0070.01016.94
7.4.120.0080.01216.82
7.4.110.0060.01316.82
7.4.100.0100.00916.72
7.4.90.0120.00816.77
7.4.80.0090.01118.12
7.4.70.0090.00916.88
7.4.60.0130.00616.81
7.4.50.0140.00316.84
7.4.40.0120.00816.82
7.4.30.0040.01316.63
7.4.20.0100.00716.76
7.4.10.0040.01316.86
7.4.00.0070.00915.96
7.3.330.0020.00213.43
7.3.320.0050.00013.43
7.3.310.0090.00016.69
7.3.300.0070.00016.60
7.3.290.0000.00716.61
7.3.280.0070.00716.59
7.3.260.0130.00816.72
7.3.240.0070.01216.70
7.3.230.0070.01116.69
7.3.220.0070.01116.73
7.3.210.0060.01216.62
7.3.200.0100.00716.60
7.3.190.0130.00516.76
7.3.180.0090.00816.70
7.3.170.0090.00716.72
7.3.160.0080.00816.71
7.3.150.0100.00716.68
7.3.140.0110.00716.64
7.3.130.0060.01216.66
7.3.120.0140.00316.93
7.3.110.0080.00816.96
7.3.100.0100.00916.90
7.3.90.0050.01216.90
7.3.80.0060.01016.88
7.3.70.0110.00516.86
7.3.60.0100.00816.94
7.3.50.0080.00816.95
7.3.40.0070.00516.89
7.3.30.0100.00816.90
7.3.20.0120.00516.86
7.3.10.0080.00916.76
7.3.00.0120.00716.90
7.2.340.0060.01217.13
7.2.330.0090.00817.01
7.2.320.0140.00817.09
7.2.310.0110.00617.06
7.2.300.0090.01216.86
7.2.290.0080.00816.81
7.2.280.0070.01116.95
7.2.270.0100.01317.08
7.2.260.0120.00616.92
7.2.250.0070.01116.89
7.2.240.0130.00617.15
7.2.230.0080.01017.05
7.2.220.0130.00417.10
7.2.210.0090.00717.02
7.2.200.0050.00816.92
7.2.190.0020.01617.10
7.2.180.0100.00917.01
7.2.170.0030.01316.99
7.2.160.0070.01117.08
7.2.150.0100.00817.03
7.2.140.0050.01317.06
7.2.130.0030.01017.12
7.2.120.0070.00817.16
7.2.110.0090.00716.96
7.2.100.0120.00717.05
7.2.90.1170.00516.47
7.2.80.0790.00916.49
7.2.70.0870.00716.67
7.2.60.1170.00916.58
7.2.50.0930.01116.51
7.2.40.0840.01116.60
7.2.30.0940.00716.67
7.2.20.0890.01216.55
7.2.10.0860.01016.54
7.2.00.0930.01116.42
7.1.330.0150.01316.40
7.1.320.0240.00516.62
7.1.310.0110.00916.46
7.1.300.0140.01016.47
7.1.290.0160.00616.39
7.1.280.0130.01016.52
7.1.270.0160.00516.52
7.1.260.0120.00916.49
7.1.250.0100.00816.32
7.1.240.0230.00715.82
7.1.230.0220.01315.83
7.1.220.0330.00515.83
7.1.210.2420.00714.75
7.1.200.1830.01014.58
7.1.190.1540.01214.79
7.1.180.1950.01614.61
7.1.170.2330.00914.69
7.1.160.1390.00814.74
7.1.150.1840.01015.03
7.1.140.1950.00714.83
7.1.130.1870.00814.94
7.1.120.1800.00414.71
7.1.110.1580.01114.87
7.1.100.1580.00914.90
7.1.90.2240.00414.67
7.1.80.2360.00714.61
7.1.70.2500.01114.81
7.1.60.2560.01123.79
7.1.50.3750.00623.94
7.1.40.4050.00823.85
7.1.30.3720.01423.65
7.1.20.4070.00923.66
7.1.10.3640.01014.53
7.1.00.1950.00914.71
7.0.330.0170.01315.70
7.0.320.0210.00715.46
7.0.310.0170.01115.55
7.0.300.0220.00815.50
7.0.290.0160.01215.57
7.0.280.0180.01015.46
7.0.270.0440.00715.48
7.0.260.0130.01615.59
7.0.250.0250.00515.53
7.0.240.0190.00815.61
7.0.230.0220.00915.41
7.0.220.0180.01815.62
7.0.210.0200.00915.53
7.0.200.0180.00915.57
7.0.190.0160.01015.48
7.0.180.0210.00815.66
7.0.170.0100.01715.51
7.0.160.0240.00915.62
7.0.150.0210.00815.51
7.0.140.0200.00915.54
7.0.130.0170.01015.51
7.0.120.0240.00715.66
7.0.110.0250.00415.62
7.0.100.0200.00815.54
7.0.90.0270.00815.57
7.0.80.0230.00315.35
7.0.70.0240.00615.50
7.0.60.0200.00715.52
7.0.50.0220.00415.58
7.0.40.0110.01715.54
7.0.30.0240.01015.46
7.0.20.0190.00915.50
7.0.10.0160.01515.54
7.0.00.0140.01415.47
5.6.400.0120.01716.12
5.6.390.0150.02216.36
5.6.380.0280.00316.01
5.6.370.0180.01216.09
5.6.360.0230.00616.34
5.6.350.0310.00016.25
5.6.340.0230.00516.45
5.6.330.0300.00016.19
5.6.320.0200.00916.33
5.6.310.0220.00816.38
5.6.300.0220.00916.34
5.6.290.0210.00916.36
5.6.280.0240.00616.28
5.6.270.0190.01316.33
5.6.260.0210.00916.29
5.6.250.0210.00716.29
5.6.240.0300.00316.26
5.6.230.0160.01316.16
5.6.220.0260.00316.05
5.6.210.0260.00616.24
5.6.200.0220.01316.16
5.6.190.0280.00616.21
5.6.180.0180.01116.09
5.6.170.0150.02016.18
5.6.160.0190.01616.15
5.6.150.0300.01016.42
5.6.140.0300.00816.27
5.6.130.0250.00616.24
5.6.120.0240.01216.32
5.6.110.0240.01316.35
5.6.100.0260.01216.02
5.6.90.0210.00916.07
5.6.80.0250.00716.07
5.6.70.0200.00816.20
5.6.60.0250.00416.07
5.6.50.0140.01415.98
5.6.40.0190.00916.08
5.6.30.0250.00316.30
5.6.20.0190.00816.05
5.6.10.0250.00516.16
5.6.00.0220.00716.18

preferences:
79.83 ms | 401 KiB | 5 Q