3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = ' <img alt="this is super nice image with lable 4" src="5.jpg" style="height:560px; width:840px"> <img alt="Description 2" src="1.jpg" style="height:560px; width:840px" class="dupa" data-label-class="label-class"> <img src="1.jpg" style="height:560px; width:840px" class="dupa" data-label-class="label-class"> '; $content = html_entity_decode($content, ENT_QUOTES, 'UTF-8'); $doc = new DOMDocument(); $doc->loadHTML($content); $tags = $doc->getElementsByTagName('img'); foreach ($tags as $tag) { // get value of an attribute $alt = $tag->getAttribute('alt'); if (!empty($alt)) { $class = $tag->getAttribute('class'); if (!empty($class)) { $class .= " picla"; } else { $class = "picla"; } $tag->setAttribute('class', $class); } } $content = $doc->saveHTML(); echo $content;

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.20.0190.00024.56
8.4.10.0040.00421.28
8.3.150.0060.01217.23
8.3.140.0040.00417.79
8.3.130.0080.00018.67
8.3.120.0030.00619.25
8.3.110.0130.00320.94
8.3.100.0030.00524.06
8.3.90.0040.00426.77
8.3.80.0030.00616.75
8.3.70.0040.01416.86
8.3.60.0150.00617.00
8.3.50.0080.01123.83
8.3.40.0040.01120.44
8.3.30.0090.00618.92
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0070.00026.16
8.2.270.0120.00616.87
8.2.260.0180.00018.94
8.2.250.0130.00618.66
8.2.240.0000.00817.22
8.2.230.0080.00022.58
8.2.220.0090.00037.54
8.2.210.0090.00626.77
8.2.200.0060.00317.00
8.2.190.0120.00616.73
8.2.180.0060.00925.92
8.2.170.0070.00719.16
8.2.160.0100.00722.96
8.2.150.0060.00325.66
8.2.140.0070.00024.66
8.2.130.0000.00726.16
8.2.120.0050.00221.37
8.2.110.0030.00622.44
8.2.100.0060.01018.09
8.2.90.0000.00917.88
8.2.80.0000.01019.02
8.2.70.0030.00618.30
8.2.60.0000.01118.28
8.2.50.0000.00818.10
8.2.40.0000.00819.59
8.2.30.0040.00419.64
8.2.20.0040.00418.36
8.2.10.0000.00719.50
8.2.00.0000.00819.67
8.1.310.0050.00317.14
8.1.300.0080.00020.32
8.1.290.0060.00318.88
8.1.280.0070.00725.92
8.1.270.0000.00922.25
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00622.36
8.1.230.0040.00718.01
8.1.220.0000.00918.03
8.1.210.0030.00518.77
8.1.200.0060.00317.60
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0080.00018.89
8.1.160.0040.00419.23
8.1.150.0070.00019.25
8.1.140.0000.00719.24
8.1.130.0040.00420.42
8.1.120.0000.00717.79
8.1.110.0040.00417.64
8.1.100.0040.00317.68
8.1.90.0040.00417.72
8.1.80.0040.00417.68
8.1.70.0040.00417.63
8.1.60.0050.00617.85
8.1.50.0050.00317.70
8.1.40.0000.00817.71
8.1.30.0030.00517.91
8.1.20.0050.00317.97
8.1.10.0040.00417.74
8.1.00.0000.00817.70
8.0.300.0040.00420.41
8.0.290.0040.00416.88
8.0.280.0000.00718.77
8.0.270.0040.00416.93
8.0.260.0000.00618.70
8.0.250.0030.00317.09
8.0.240.0030.00317.18
8.0.230.0040.00417.17
8.0.220.0000.00717.09
8.0.210.0080.00017.12
8.0.200.0030.00517.11
8.0.190.0080.00017.16
8.0.180.0040.00417.07
8.0.170.0030.00617.13
8.0.160.0000.00717.21
8.0.150.0030.00516.98
8.0.140.0000.00817.06
8.0.130.0030.00313.53
8.0.120.0050.00317.00
8.0.110.0040.00417.14
8.0.100.0040.00416.97
8.0.90.0040.00417.21
8.0.80.0050.00917.14
8.0.70.0060.00316.90
8.0.60.0000.00717.26
8.0.50.0000.00817.18
8.0.30.0070.01017.11
8.0.20.0110.01017.11
8.0.10.0050.00317.07
8.0.00.0150.00917.15
7.4.330.0030.00315.55
7.4.320.0030.00316.73
7.4.300.0030.00316.84
7.4.290.0030.00316.85
7.4.280.0040.00416.83
7.4.270.0000.00716.83
7.4.260.0030.00413.49
7.4.250.0030.00316.83
7.4.240.0040.00516.83
7.4.230.0030.00316.98
7.4.220.0030.00316.91
7.4.210.0070.01016.83
7.4.200.0030.00316.96
7.4.130.0140.00616.74
7.4.120.0110.01216.47
7.4.110.0070.01016.64
7.4.100.0090.00916.63
7.4.90.0130.00316.65
7.4.80.0140.00716.55
7.4.70.0030.01716.48
7.4.60.0160.00616.35
7.4.50.0140.00316.57
7.4.40.0100.00716.66
7.4.30.0070.01016.67
7.4.20.0070.01016.58
7.4.10.0130.00316.61
7.4.00.0090.00816.71
7.3.330.0040.00416.32
7.3.320.0000.00513.35
7.3.310.0030.00316.48
7.3.300.0040.00416.47
7.3.290.0020.01316.47
7.3.260.0150.00916.95
7.3.230.0060.01516.72
7.3.220.0070.01016.51
7.3.210.0070.01016.51
7.3.200.0070.01016.43
7.3.190.0070.01316.45
7.3.180.0180.00316.57
7.3.170.0130.00416.83
7.3.160.0030.01416.72
7.3.150.0040.01216.48
7.3.140.0110.00716.74
7.3.130.0140.00316.68
7.3.120.0070.01016.75
7.3.110.0090.00916.57
7.3.100.0100.00716.72
7.3.90.0060.01016.73
7.3.80.0070.01016.53
7.3.70.0100.00716.50
7.3.60.0100.00716.59
7.3.50.0130.00316.63
7.3.40.0090.00916.55
7.3.30.0110.00716.56
7.3.20.0190.00616.63
7.3.10.0130.01216.48
7.3.00.0100.00716.55
7.2.330.0180.00316.71
7.2.320.0210.00016.61
7.2.310.0060.01716.99
7.2.300.0070.01116.89
7.2.290.0070.01016.75
7.2.280.0150.00316.82
7.2.270.0140.00316.98
7.2.260.0030.01316.60
7.2.250.0140.00317.01
7.2.240.0120.00916.93
7.2.230.0060.01316.72
7.2.220.0070.01016.90
7.2.210.0070.01116.77
7.2.200.0100.00716.87
7.2.190.0080.00916.85
7.2.180.0100.00716.93
7.2.170.0060.01216.74
7.2.160.0030.01516.64
7.2.150.0110.00716.89
7.2.140.0120.01316.93
7.2.130.0140.00816.86
7.2.120.0110.00717.14
7.2.110.0040.01416.73
7.2.100.0070.01116.90
7.2.90.0120.01216.64
7.2.80.0260.00016.74
7.2.70.0120.01516.94
7.2.60.0000.01816.93
7.2.50.0180.00316.84
7.2.40.0090.00916.99
7.2.30.0140.00416.86
7.2.20.0110.00816.89
7.2.10.0060.01216.95
7.2.00.0120.00616.82

preferences:
27.26 ms | 403 KiB | 5 Q