3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<EOT <p>List of sample images.</p> <img src="https://placehold.it/250x100/99cc00/000.jpg?text=JPG" alt="JPG" /><br> <img src="https://placehold.it/250x100.gif?text=GIF" alt="GIF" /><br> <img src="https://placehold.it/250x100/ff6600/000.png?text=PNG" alt="PNG" /><br> <img class="no-ext" src="https://placehold.it/350x150?text=No Extension" alt="No Ext" /><br> <img src="https://placehold.it/250x100.png" custom-attr="custom1" another-attr="custom2" /><br> <img class="svg" src="https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg" alt="SVG" /><br> <img class="webp" src="https://gstatic.com/webp/gallery/1.webp" width="100" alt="webP" /><br> EOT; # Find all content with <img> tags preg_match_all( '/(?:<img|(?<!^)\G)\h*([-\w]+)="([^"]+)"(?=.*?\/>)/', $content, $images ); foreach ( $images[1] as $attributes[1] => $value ) { echo( '< img ' . $value . '="' . 'value' . '" ><br>' ); } //echo "<pre>"; print_r($images); $temp = array(); foreach($images[0] as $key=>$img){ $pos = strpos($img,'<img'); if($pos === false){ $temp[$key_2][] = $img; }else{ $temp[$key][] = $img; $key_2 = $key; } } foreach($temp as $k=>$v){ $str[] = implode(' ', $v) . ' />'; } $finalStr = implode('<br />', $str); echo $finalStr;

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.120.0130.00820.54
8.4.110.0100.00720.44
8.4.100.0130.00718.70
8.4.90.0090.00918.83
8.4.80.0130.00719.99
8.4.70.0010.00718.12
8.4.60.0110.01118.79
8.4.50.0110.00818.79
8.4.40.0070.01119.66
8.4.30.0180.00419.71
8.4.20.0030.01718.06
8.4.10.0070.00417.91
8.3.250.0120.00718.82
8.3.240.0070.01216.66
8.3.230.0110.00916.63
8.3.220.0110.00819.16
8.3.210.0120.00818.52
8.3.200.0070.00216.87
8.3.190.0100.00917.05
8.3.180.0130.00716.61
8.3.170.0040.01418.75
8.3.160.0120.00616.58
8.3.150.0000.00917.18
8.3.140.0080.00016.53
8.3.130.0090.00016.70
8.3.120.0030.00520.61
8.3.110.0090.00020.94
8.3.100.0090.00016.88
8.3.90.0100.00326.77
8.3.80.0060.00317.97
8.3.70.0070.00718.68
8.3.60.0120.00316.99
8.3.50.0090.00921.15
8.3.40.0100.00719.18
8.3.30.0150.00019.12
8.3.20.0040.00420.29
8.3.10.0040.00421.95
8.3.00.0040.00421.76
8.2.290.0110.00720.32
8.2.280.0080.01118.74
8.2.270.0040.01219.02
8.2.260.0150.00018.72
8.2.250.0040.00417.01
8.2.240.0080.00818.92
8.2.230.0030.00722.58
8.2.220.0000.01424.06
8.2.210.0070.00726.77
8.2.200.0030.00616.75
8.2.190.0120.00316.75
8.2.180.0210.00418.22
8.2.170.0100.00722.96
8.2.160.0070.00719.28
8.2.150.0070.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0060.00319.25
8.2.110.0070.00319.39
8.2.100.0090.00617.84
8.2.90.0000.00917.75
8.2.80.0000.01218.94
8.2.70.0040.00417.75
8.2.60.0000.00917.88
8.2.50.0030.00517.88
8.2.40.0040.00420.60
8.2.30.0000.00819.55
8.2.20.0070.00018.23
8.2.10.0040.00418.24
8.2.00.0070.00018.31
8.1.330.0080.01121.78
8.1.320.0140.00518.42
8.1.310.0030.00618.65
8.1.300.0050.00316.23
8.1.290.0110.00630.84
8.1.280.0110.00425.92
8.1.270.0110.00723.99
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0060.00319.35
8.1.230.0110.00022.31
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0060.00317.38
8.1.190.0000.00817.35
8.1.180.0000.00818.10
8.1.170.0000.00818.77
8.1.160.0050.00218.86
8.1.150.0000.00720.31
8.1.140.0040.00419.63
8.1.130.0030.00519.06
8.1.120.0070.00017.64
8.1.110.0040.00417.55
8.1.100.0040.00417.54
8.1.90.0020.00517.52
8.1.80.0020.00517.64
8.1.70.0000.00717.68
8.1.60.0050.00317.68
8.1.50.0080.00017.73
8.1.40.0030.00617.53
8.1.30.0040.00417.79
8.1.20.0040.00417.84
8.1.10.0000.00817.78
8.1.00.0090.00017.70
8.0.300.0030.00618.77
8.0.290.0000.00816.88
8.0.280.0000.00718.55
8.0.270.0000.00717.05
8.0.260.0050.00217.30
8.0.250.0070.00017.16
8.0.240.0060.00317.20
8.0.230.0070.00017.08
8.0.220.0000.00717.12
8.0.210.0070.00017.04
8.0.200.0070.00017.25
8.0.190.0080.00417.21
8.0.180.0040.00417.14
8.0.170.0000.00717.11
8.0.160.0040.00417.04
8.0.150.0000.00717.14
8.0.140.0000.00717.06
8.0.130.0040.00413.57
8.0.120.0040.00417.06
8.0.110.0060.00317.10
8.0.100.0040.00417.17
8.0.90.0040.00417.19
8.0.80.0040.01617.11
8.0.70.0000.00717.13
8.0.60.0040.00417.06
8.0.50.0040.00417.13
8.0.30.0130.00717.21
8.0.20.0100.00917.44
8.0.10.0040.00417.30
8.0.00.0090.00917.23
7.4.330.0000.00515.55
7.4.320.0050.00316.87
7.4.300.0000.00616.66
7.4.290.0000.00716.84
7.4.280.0030.00516.84
7.4.270.0000.00716.84
7.4.260.0070.00016.85
7.4.250.0070.00016.70
7.4.240.0070.00016.86
7.4.230.0040.00416.94
7.4.220.0000.01616.86
7.4.210.0030.01216.77
7.4.200.0000.00716.65
7.4.160.0150.00716.71
7.4.150.0110.00717.40
7.4.140.0100.01317.86
7.4.130.0110.00716.87
7.4.120.0150.00916.86
7.4.110.0040.01316.87
7.4.100.0060.01216.86
7.4.90.0150.00316.63
7.4.80.0160.00919.39
7.4.70.0090.00816.71
7.4.60.0070.01016.79
7.4.50.0140.00316.63
7.4.40.0140.00316.56
7.4.30.0030.01416.54
7.4.10.0060.01215.11
7.4.00.0050.01315.19
7.3.330.0030.00313.39
7.3.320.0050.00013.44
7.3.310.0040.00416.65
7.3.300.0070.00016.56
7.3.290.0070.00916.54
7.3.280.0110.00816.57
7.3.270.0100.00717.40
7.3.260.0080.01116.62
7.3.250.0080.01116.66
7.3.240.0080.01416.70
7.3.230.0070.01016.83
7.3.210.0110.00716.52
7.3.200.0060.01216.62
7.3.190.0130.00516.81
7.3.180.0070.01016.75
7.3.170.0040.01216.61
7.3.160.0060.01616.57
7.3.130.0090.00914.97
7.3.120.0070.01015.06
7.3.110.0060.01115.20
7.3.100.0110.00515.18
7.3.90.0040.00915.06
7.3.80.0030.01114.86
7.3.70.0030.00715.09
7.3.60.0040.00915.13
7.3.50.0050.01015.01
7.3.40.0070.00714.88
7.3.30.0020.01315.08
7.3.20.0030.01217.02
7.3.10.0090.00717.00
7.3.00.0070.00816.65
7.2.330.0130.00616.80
7.2.320.0150.00916.81
7.2.310.0110.01116.87
7.2.300.0030.02016.82
7.2.290.0080.01116.92
7.2.260.0030.01615.19
7.2.250.0070.00915.34
7.2.240.0100.00515.29
7.2.230.0050.01215.31
7.2.220.0090.00615.24
7.2.210.0090.00415.09
7.2.200.0050.00815.18
7.2.190.0070.00815.22
7.2.180.0110.00315.23
7.2.170.0070.00615.33
7.2.160.0000.01815.30
7.2.150.0040.01117.13
7.2.140.0130.00617.27
7.2.130.0050.00516.99
7.2.120.0030.01417.32
7.2.110.0070.00716.90
7.2.100.0070.00717.14
7.2.90.0070.01017.16
7.2.80.0070.00417.36
7.2.70.0030.01016.88
7.2.60.0100.00916.88
7.2.50.0080.00716.96
7.2.40.0070.00416.87
7.2.30.0030.01317.31
7.2.20.0070.00717.26
7.2.10.0110.00417.20
7.2.00.0030.01017.16
7.1.330.0050.00816.09
7.1.320.0040.01116.10
7.1.310.0060.00515.92
7.1.300.0090.00715.81
7.1.290.0060.00716.00
7.1.280.0050.00715.98
7.1.270.0080.00816.02
7.1.260.0050.01216.02
7.1.250.0000.01116.12
7.1.240.0120.00416.16
7.1.230.0050.00516.14
7.1.220.0070.00716.05
7.1.210.0110.00515.91
7.1.200.0020.00915.92
7.1.190.0070.00315.89
7.1.180.0000.01315.99
7.1.170.0030.01315.89
7.1.160.0030.00716.04
7.1.150.0090.00315.98
7.1.140.0040.01116.00
7.1.130.0060.00915.95
7.1.120.0060.00315.80
7.1.110.0040.00916.18
7.1.100.0130.00316.03
7.1.90.0110.00716.16
7.1.80.0090.00316.02
7.1.70.0060.00816.67
7.1.60.1740.00715.61
7.1.50.0070.00716.04
7.1.40.0110.00315.70
7.1.30.0130.04426.13
7.1.20.1900.03726.35
7.1.10.0080.03518.25
7.1.00.0130.02918.38
7.0.330.0030.01015.61
7.0.320.0030.01215.63
7.0.310.0030.00715.51
7.0.300.0060.00915.76
7.0.290.0060.00615.43
7.0.280.0060.00915.36
7.0.270.0080.00415.65
7.0.260.0080.00615.57
7.0.250.0070.00515.64
7.0.240.0070.01015.50
7.0.230.0000.01415.81
7.0.220.0060.00615.54
7.0.210.0000.01115.84
7.0.200.0050.01216.11
7.0.190.0000.01415.42
7.0.180.0060.00315.74
7.0.170.0120.03717.81
7.0.160.2200.03817.81
7.0.150.0090.03517.79
7.0.140.0120.03717.92
7.0.130.0080.03817.82
7.0.120.0100.03017.81
7.0.110.0130.03017.83
7.0.100.0090.03417.74
7.0.90.0070.03917.90
7.0.80.0130.03517.94
7.0.70.0110.04117.86
7.0.60.0130.03017.75
7.0.50.0180.02917.81
7.0.40.0600.04416.80
7.0.30.0160.03017.03
7.0.20.0150.03616.85
7.0.10.0680.03316.87
7.0.00.0770.02816.86
5.6.400.0040.01314.71
5.6.390.0080.00414.70
5.6.380.0030.01014.80
5.6.370.0040.00714.29
5.6.360.0030.01314.76
5.6.350.0060.00914.59
5.6.340.0070.00714.75
5.6.330.0080.00614.43
5.6.320.0000.01314.50
5.6.310.0090.00914.32
5.6.300.0070.00714.64
5.6.290.0040.00914.77
5.6.280.0160.00014.66
5.6.270.0060.01014.35
5.6.260.0090.00614.64
5.6.250.0040.00914.61
5.6.240.0040.00814.42
5.6.230.0070.00314.65
5.6.220.0110.00314.50
5.6.210.0000.01314.46
5.6.200.0130.00314.25
5.6.190.0000.01814.47
5.6.180.0120.00914.33
5.6.170.0000.01514.33
5.6.160.0030.01014.45
5.6.150.0030.01414.58
5.6.140.0100.01014.41
5.6.130.0040.01114.27
5.6.120.0100.00614.55
5.6.110.0070.00414.20
5.6.100.0070.01014.92
5.6.90.0060.00914.39
5.6.80.0000.00914.27
5.6.70.0100.00614.41
5.6.60.0030.00914.71
5.6.50.0090.00614.76
5.6.40.0000.02014.57
5.6.30.0000.01514.42
5.6.20.0080.00814.19
5.6.10.0040.00814.52
5.6.00.0090.00914.33

preferences:
28.99 ms | 403 KiB | 5 Q