3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '<figure class="image image-style-align-left"><img src="https://placekitten.com/g/200/300"></figure><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>'; $dom = new DOMDocument(); libxml_use_internal_errors(true); // this needs to be encoded otherwise special characters get messed up. $domPart = mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8"); $dom->loadHTML($domPart, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $domFigures = $dom->getElementsByTagName('figure'); foreach ($domFigures as $domFigure) { $img = $domFigure->getElementsByTagName('img')[0]; if ($img) { $img->setAttribute('src', "https://placekitten.com/g/400/500"); } } $result = $dom->saveHTML(); print_r($result);

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.0180.00717.85
8.4.130.0100.01117.92
8.4.120.0060.01320.78
8.4.110.0130.00820.84
8.4.100.0130.00818.15
8.4.90.0120.00818.25
8.4.80.0090.00421.21
8.4.70.0100.00518.11
8.4.60.0130.00718.56
8.4.50.0110.00718.95
8.4.40.0060.00918.13
8.4.30.0070.01122.54
8.4.20.0130.00720.88
8.4.10.0060.00317.93
8.3.270.0130.00716.85
8.3.260.0140.00517.11
8.3.250.0110.00819.11
8.3.240.0120.00616.82
8.3.230.0120.00716.80
8.3.220.0120.00617.16
8.3.210.0100.01017.18
8.3.200.0140.00517.42
8.3.190.0130.00617.60
8.3.180.0100.00717.26
8.3.170.0120.00619.27
8.3.160.0110.00720.29
8.3.150.0080.01117.32
8.3.140.0140.00717.50
8.3.130.0040.01518.79
8.3.120.0000.01119.08
8.3.110.0050.00320.94
8.3.100.0000.00916.99
8.3.90.0150.00320.55
8.3.80.0050.00518.93
8.3.70.0040.01117.00
8.3.60.0060.00918.68
8.3.50.0110.00718.79
8.3.40.0120.00319.08
8.3.30.0110.00419.27
8.3.20.0000.00821.15
8.3.10.0080.00022.11
8.3.00.0040.00424.08
8.2.290.0060.00321.00
8.2.280.0050.01017.25
8.2.270.0110.00719.11
8.2.260.0030.00819.03
8.2.250.0050.00316.87
8.2.240.0060.00319.18
8.2.230.0110.00422.58
8.2.220.0030.00624.06
8.2.210.0150.00326.77
8.2.200.0090.00016.61
8.2.190.0110.00416.88
8.2.180.0080.00817.13
8.2.170.0120.00319.24
8.2.160.0110.00420.64
8.2.150.0050.00524.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00420.82
8.2.110.0000.00921.31
8.2.100.0040.00718.27
8.2.90.0040.00818.19
8.2.80.0030.00918.28
8.2.70.0030.00518.29
8.2.60.0080.00018.47
8.2.50.0040.00418.10
8.2.40.0080.00019.72
8.2.30.0080.00019.52
8.2.20.0030.00518.50
8.2.10.0060.00319.65
8.2.00.0040.00419.73
8.1.330.0070.01116.89
8.1.320.0130.00618.19
8.1.310.0040.01118.46
8.1.300.0090.00018.50
8.1.290.0060.00618.88
8.1.280.0110.00725.92
8.1.270.0090.00324.22
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0160.00324.16
8.1.230.0110.00021.14
8.1.220.0050.00318.14
8.1.210.0040.00419.29
8.1.200.0110.00017.73
8.1.190.0080.00017.72
8.1.180.0030.00618.10
8.1.170.0030.00618.86
8.1.160.0020.00519.32
8.1.150.0000.00719.23
8.1.140.0070.00019.16
8.1.130.0070.00020.40
8.1.120.0000.00717.77
8.1.110.0040.00417.70
8.1.100.0040.00417.72
8.1.90.0000.00917.80
8.1.80.0040.00417.74
8.1.70.0050.00517.77
8.1.60.0080.00317.85
8.1.50.0000.00717.84
8.1.40.0000.00917.84
8.1.30.0030.00617.93
8.1.20.0000.01217.92
8.1.10.0000.00717.82
8.1.00.0030.00717.82
8.0.300.0050.00219.90
8.0.290.0040.00416.88
8.0.280.0040.00418.73
8.0.270.0030.00317.48
8.0.260.0040.00418.80
8.0.250.0070.00017.26
8.0.240.0070.00017.18
8.0.230.0000.00717.22
8.0.220.0050.00217.20
8.0.210.0000.00717.20
8.0.200.0070.00017.18
8.0.190.0030.00517.20
8.0.180.0000.00817.23
8.0.170.0000.00817.20
8.0.160.0050.00317.15
8.0.150.0030.00517.13
8.0.140.0080.00017.18
8.0.130.0050.00013.64
8.0.120.0060.00317.06
8.0.110.0000.00817.20
8.0.100.0040.00417.08
8.0.90.0040.00417.18
8.0.80.0080.01117.20
8.0.70.0050.00216.94
8.0.60.0040.00417.27
8.0.50.0070.00017.16
8.0.30.0130.00617.48
8.0.20.0180.00417.17
8.0.10.0070.00017.06
8.0.00.0130.01117.17
7.4.330.0000.00515.55
7.4.320.0060.00016.85
7.4.300.0000.00616.75
7.4.290.0030.00416.85
7.4.280.0040.00416.80
7.4.270.0000.00616.85
7.4.260.0050.00316.81
7.4.250.0000.00816.71
7.4.240.0040.00416.78
7.4.230.0050.00316.94
7.4.220.0000.00817.03
7.4.210.0080.00916.96
7.4.200.0070.00016.73
7.4.160.0110.00816.84
7.4.130.0070.01116.58
7.4.120.0130.00316.71
7.4.110.0090.00917.01
7.4.100.0180.00316.81
7.4.90.0120.00616.77
7.4.80.0040.01619.39
7.4.70.0130.00317.00
7.4.60.0060.01216.70
7.4.50.0110.00316.71
7.4.40.0080.01216.60
7.4.00.0070.00815.21
7.3.330.0000.00613.55
7.3.320.0000.00613.50
7.3.310.0000.00716.53
7.3.300.0040.00416.41
7.3.290.0080.00816.62
7.3.280.0060.01216.60
7.3.260.0090.00916.80
7.3.240.0100.00816.80
7.3.230.0100.01016.69
7.3.210.0060.01216.56
7.3.200.0060.01216.61
7.3.190.0140.00316.89
7.3.180.0030.01316.89
7.3.170.0120.01216.73
7.3.160.0150.00016.80
7.3.120.0060.01314.95
7.3.110.0100.00815.02
7.3.100.0100.00615.07
7.3.90.0090.00714.86
7.3.80.0100.00614.92
7.3.70.0010.00814.80
7.3.60.0070.00714.85
7.3.50.0070.00714.91
7.3.40.0060.00614.79
7.3.30.0040.01114.95
7.3.20.0060.00716.20
7.3.10.0060.00716.18
7.3.00.0070.01016.08
7.2.330.0090.00917.07
7.2.320.0130.00716.70
7.2.310.0110.00616.95
7.2.300.0040.01917.07
7.2.290.0080.00817.08
7.2.250.0080.01115.14
7.2.240.0080.01015.27
7.2.230.0030.01215.10
7.2.220.0120.00515.11
7.2.210.0060.01015.34
7.2.200.0040.01315.04
7.2.190.0060.01015.19
7.2.180.0080.00615.22
7.2.170.0040.00715.10
7.2.160.0090.01115.22
7.2.150.0090.00414.95
7.2.140.0190.00615.04
7.2.130.0090.00615.09
7.2.120.0120.00915.28
7.2.110.0110.01015.22
7.2.100.0170.00715.15
7.2.90.0240.00715.20
7.2.80.0110.00815.08
7.2.70.0110.00315.18
7.2.60.0030.01015.36
7.2.50.0230.01015.30
7.2.40.0150.00015.37
7.2.30.0200.01015.32
7.2.20.0080.00815.12
7.2.10.0150.00015.23
7.2.00.0160.00715.03
7.1.330.0030.01115.82
7.1.320.0050.00815.77
7.1.310.0050.00815.95
7.1.300.0070.01315.37
7.1.290.0300.00415.34
7.1.280.0080.00815.33
7.1.270.0070.01115.34
7.1.260.0050.00915.45
7.1.250.0100.00413.89

preferences:
140.61 ms | 403 KiB | 5 Q