3v4l.org

run code in 300+ PHP versions simultaneously
<?php function walkDOM($node) { if($node->nodeName=="pre" || $node->nodeName=="code") { return; } elseif($node->nodeName=="img") { $node->attributes->getNamedItem("src")->nodeValue=str_replace('desktop-img','mobile-img',$node->attributes->getNamedItem("src")->nodeValue); } elseif($node->hasChildNodes()) { foreach($node->childNodes as $child) { walkDOM($child); } } } function changeImagePath($html) { $dom=new DOMDocument; $dom->preserveWhiteSpace=true; $dom->loadHTML($html); $root=$dom->documentElement; walkDOM($root); $dom->formatOutput=false; return $dom->saveHTML($root); } echo changeImagePath(<<<HTML <div class="wrapper"> <img src="img/demo/desktop-img/sample1.jpg" width="200" height="200" alt="image"> <img src="img/demo/desktop-img/sample2.jpg" width="200" height="200" alt="image"> <pre> <img src="img/demo/desktop-img/sample1.jpg" width="200" height="200" alt="image"> <img src="img/demo/desktop-img/sample2.jpg" width="200" height="200" alt="image"> </pre> <code> <img src="img/demo/desktop-img/sample1.jpg" width="200" height="200" alt="image"> <img src="img/demo/desktop-img/sample2.jpg" width="200" height="200" alt="image"> </code> </div> HTML );

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.60.0120.00316.63
8.3.50.0110.00622.22
8.3.40.0070.00719.25
8.3.30.0100.00619.52
8.3.20.0050.00320.61
8.3.10.0000.00823.78
8.3.00.0100.00018.18
8.2.180.0160.00616.88
8.2.170.0120.00622.96
8.2.160.0100.00720.60
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0090.00026.16
8.2.120.0080.00021.37
8.2.110.0080.00321.16
8.2.100.0060.00618.16
8.2.90.0050.00317.88
8.2.80.0040.00418.18
8.2.70.0030.00617.88
8.2.60.0070.00318.16
8.2.50.0000.00818.10
8.2.40.0030.00622.38
8.2.30.0040.00418.51
8.2.20.0000.00817.84
8.2.10.0080.00018.26
8.2.00.0000.00817.95
8.1.280.0070.00725.92
8.1.270.0090.00024.04
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00322.27
8.1.230.0110.00022.86
8.1.220.0030.00617.80
8.1.210.0040.00418.77
8.1.200.0090.00017.73
8.1.190.0000.00917.60
8.1.180.0040.00418.10
8.1.170.0000.00818.90
8.1.160.0050.00322.12
8.1.150.0000.00819.19
8.1.140.0040.00417.62
8.1.130.0000.00718.13
8.1.120.0020.00517.72
8.1.110.0040.00417.71
8.1.100.0040.00417.70
8.1.90.0050.00217.63
8.1.80.0050.00317.72
8.1.70.0000.00717.65
8.1.60.0030.00517.89
8.1.50.0040.00417.72
8.1.40.0040.00417.73
8.1.30.0040.00417.87
8.1.20.0000.00817.84
8.1.10.0030.00617.80
8.1.00.0000.00817.67
8.0.300.0030.00522.19
8.0.290.0040.00417.00
8.0.280.0040.00418.59
8.0.270.0030.00317.42
8.0.260.0000.00717.54
8.0.250.0080.00017.21
8.0.240.0050.00317.13
8.0.230.0040.00417.25
8.0.220.0000.00717.11
8.0.210.0030.00317.21
8.0.200.0030.00317.16
8.0.190.0000.00817.16
8.0.180.0040.00417.23
8.0.170.0040.00417.15
8.0.160.0050.00217.11
8.0.150.0000.00717.11
8.0.140.0080.00017.08
8.0.130.0040.00413.64
8.0.120.0040.00417.09
8.0.110.0000.00717.26
8.0.100.0020.00517.08
8.0.90.0030.00517.07
8.0.80.0050.01217.14
8.0.70.0080.00017.13
8.0.60.0050.00217.27
8.0.50.0040.00417.08
8.0.30.0110.01017.45
8.0.20.0110.00817.45
8.0.10.0070.00017.29
8.0.00.0070.01316.80
7.4.330.0030.00315.29
7.4.320.0030.00316.75
7.4.300.0000.00716.66
7.4.290.0000.00816.70
7.4.280.0040.00416.78
7.4.270.0050.00216.75
7.4.260.0060.00316.67
7.4.250.0000.00716.72
7.4.240.0040.00416.71
7.4.230.0070.00016.59
7.4.220.0110.00716.98
7.4.210.0030.01316.71
7.4.200.0040.00416.53
7.4.160.0140.00316.54
7.4.150.0120.00617.40
7.4.140.0090.00817.86
7.4.130.0090.00916.88
7.4.120.0080.01016.82
7.4.110.0030.01617.07
7.4.100.0040.01416.82
7.4.90.0100.00716.80
7.4.80.0070.01619.39
7.4.70.0090.00916.73
7.4.60.0100.01016.88
7.4.50.0080.00016.64
7.4.40.0150.00616.91
7.4.30.0060.01216.90
7.4.10.0150.00314.88
7.4.00.0080.01014.89
7.3.330.0000.00513.47
7.3.320.0030.00313.49
7.3.310.0000.00716.54
7.3.300.0030.00316.34
7.3.290.0070.00716.52
7.3.280.0120.00616.52
7.3.270.0100.01017.40
7.3.260.0120.00616.67
7.3.250.0130.00916.67
7.3.240.0140.00416.71
7.3.230.0090.00616.78
7.3.210.0100.00716.73
7.3.200.0090.01219.39
7.3.190.0070.01016.70
7.3.180.0100.01016.63
7.3.170.0140.00316.52
7.3.160.0060.01016.59
7.3.130.0140.00314.77
7.3.120.0080.00714.92
7.3.110.0090.00814.59
7.3.100.0100.00514.90
7.3.90.0050.00614.71
7.3.80.0100.00414.91
7.3.70.0020.01414.82
7.3.60.0070.00814.97
7.3.50.0000.01114.76
7.3.40.0060.00714.82
7.3.30.0060.00714.86
7.3.20.0030.00916.70
7.3.10.0080.00516.63
7.3.00.0050.00716.75
7.2.330.0000.02016.94
7.2.320.0180.00317.00
7.2.310.0130.01017.04
7.2.300.0100.01016.82
7.2.290.0060.01216.63
7.2.260.0060.01215.29
7.2.250.0090.00714.96
7.2.240.0100.00715.34
7.2.230.0080.00815.35
7.2.220.0060.00915.04
7.2.210.0020.01415.03
7.2.200.0060.00515.06
7.2.190.0060.00915.16
7.2.180.0090.00615.26
7.2.170.0090.00815.20
7.2.160.0080.00415.07
7.2.150.0000.01617.05
7.2.140.0000.01017.13
7.2.130.0000.01516.96
7.2.120.0080.00616.95
7.2.110.0130.00016.95
7.2.100.0050.00517.16
7.2.90.0060.00616.99
7.2.80.0000.00917.16
7.2.70.0110.00317.19
7.2.60.0060.00616.93
7.2.50.0000.01517.10
7.2.40.0070.01017.02
7.2.30.0090.00616.85
7.2.20.0000.01717.09
7.2.10.0070.01116.94
7.2.00.0030.01118.36
7.1.330.0070.00715.88
7.1.320.0080.00615.80
7.1.310.0030.00915.77
7.1.300.0060.00815.71
7.1.290.0040.00815.85
7.1.280.0130.00915.88
7.1.270.0040.00915.86
7.1.260.0080.00615.69
7.1.250.0000.01016.00
7.1.240.0000.01315.74
7.1.230.0090.00616.03
7.1.220.0070.00715.96
7.1.210.0030.01015.89
7.1.200.0050.00615.93
7.1.190.0080.00816.11
7.1.180.0110.00415.59
7.1.170.0040.00715.94
7.1.160.0040.00416.11
7.1.150.0040.00815.87
7.1.140.0070.01015.62
7.1.130.0070.00315.82
7.1.120.0040.01115.94
7.1.110.0030.01416.13
7.1.100.0070.00517.05
7.1.90.0030.01415.69
7.1.80.0060.00315.94
7.1.70.0030.01216.56
7.1.60.0060.01017.67
7.1.50.0060.00916.32
7.1.40.0070.00715.77
7.1.30.0000.00915.88
7.1.20.0000.00915.77
7.1.10.0060.00615.95
7.1.00.0070.03819.25
7.0.330.0030.00615.59
7.0.320.0040.00815.48
7.0.310.0030.00615.59
7.0.300.0130.00015.43
7.0.290.0090.00015.40
7.0.280.0030.00715.48
7.0.270.0040.01115.48
7.0.260.0120.00315.60
7.0.250.0040.01115.53
7.0.240.0070.01015.35
7.0.230.0030.00615.69
7.0.220.0030.00715.45
7.0.210.0000.01315.45
7.0.200.0030.00716.10
7.0.190.0090.00915.30
7.0.180.0030.01015.49
7.0.170.0030.01015.61
7.0.160.0040.00815.52
7.0.150.0040.01115.32
7.0.140.0050.03918.78
7.0.130.0000.01015.40
7.0.120.0040.01115.42
7.0.110.0000.01415.63
7.0.100.0040.00815.45
7.0.90.0090.00315.31
7.0.80.0040.00415.25
7.0.70.0070.00715.46
7.0.60.0060.03417.89
7.0.50.0080.02216.77
7.0.40.0070.02216.89
7.0.30.0180.03216.85
7.0.20.0120.04116.95
7.0.10.0030.03416.93
7.0.00.0060.04317.07
5.6.400.0040.00814.87
5.6.390.0030.00914.51
5.6.380.0070.00414.61
5.6.370.0070.00714.93
5.6.360.0000.01514.47
5.6.350.0070.00314.13
5.6.340.0080.00814.34
5.6.330.0060.00814.63
5.6.320.0100.00714.46
5.6.310.0000.01714.43
5.6.300.0100.00314.61
5.6.290.0110.00014.49
5.6.280.0030.04117.86
5.6.270.0040.01214.49
5.6.260.0060.00314.64
5.6.250.0110.00314.46
5.6.240.0070.00714.84
5.6.230.0110.00014.82
5.6.220.0030.00714.45
5.6.210.0070.03917.62
5.6.200.0100.04116.42
5.6.190.0080.03017.64
5.6.180.0200.03617.53
5.6.170.0120.03117.58
5.6.160.0090.03217.53
5.6.150.0050.03016.28
5.6.140.0030.03616.38
5.6.130.0030.04316.37
5.6.120.0050.04317.80
5.6.110.0050.04217.78
5.6.100.0110.04217.85
5.6.90.0030.02617.87
5.6.80.0070.02917.60
5.6.70.0080.00914.40
5.6.60.0060.00614.68
5.6.50.0070.01114.59
5.6.40.0040.00814.48
5.6.30.0090.00314.44
5.6.20.0040.00814.53
5.6.10.0030.00714.57
5.6.00.0090.00914.34
5.5.380.0080.00714.64
5.5.370.0040.00814.68
5.5.360.0090.00614.72
5.5.350.0220.04217.55
5.5.340.0050.02616.08
5.5.330.0050.02417.59
5.5.320.0040.02717.55
5.5.310.0190.04317.48
5.5.300.0050.04016.33
5.5.290.0080.03416.21
5.5.280.0050.04717.59
5.5.270.0040.03217.63
5.5.260.0070.04517.80
5.5.250.0030.02817.60
5.5.240.0050.02317.32
5.5.230.0000.01414.48
5.5.220.0060.00614.13
5.5.210.0030.00914.41
5.5.200.0100.00714.32
5.5.190.0000.01214.67
5.5.180.0070.01014.40
5.5.170.0030.00714.46
5.5.160.0100.00614.29
5.5.150.0030.00914.45
5.5.140.0110.00314.34
5.5.130.0000.01214.00
5.5.120.0120.00614.62
5.5.110.0070.00714.33
5.5.100.0070.00714.45
5.5.90.0060.00314.40
5.5.80.0120.00314.47
5.5.70.0000.00814.33
5.5.60.0090.00614.38
5.5.50.0000.01414.64
5.5.40.0030.00914.57
5.5.30.0060.00614.25
5.5.20.0030.01014.42
5.5.10.0050.00514.20
5.5.00.0040.00414.46
5.4.450.0070.02415.44
5.4.440.0030.04015.35
5.4.430.0050.04415.26
5.4.420.0070.04215.27
5.4.410.0030.04015.41
5.4.400.0080.03015.17
5.4.390.0040.02714.95
5.4.380.0060.02414.96
5.4.370.0080.03315.16
5.4.360.0100.02215.16
5.4.350.0080.02115.10
5.4.340.0050.03815.11
5.4.330.0040.01111.25
5.4.320.0070.03015.31
5.4.310.0090.03915.26
5.4.300.0050.04215.25
5.4.290.0030.03015.13
5.4.280.0070.04015.27
5.4.270.0100.03815.08
5.4.260.0070.03615.11
5.4.250.0060.02515.03
5.4.240.0050.02615.14
5.4.230.0070.02215.17
5.4.220.0030.02515.30
5.4.210.0030.03815.33
5.4.200.0030.03715.31
5.4.190.0070.04014.97
5.4.180.0100.03515.10
5.4.170.0070.04015.33
5.4.160.0030.02814.95
5.4.150.0100.03715.24
5.4.140.0070.02513.73
5.4.130.0080.01613.88
5.4.120.0060.02313.72
5.4.110.0070.03013.91
5.4.100.0030.04113.98
5.4.90.0050.03713.89
5.4.80.0100.03713.84
5.4.70.0080.04013.67
5.4.60.0020.04613.79
5.4.50.0050.02013.76
5.4.40.0050.04213.91
5.4.30.0050.03713.89
5.4.20.0030.03513.91
5.4.10.0060.03313.95
5.4.00.0050.03713.64
5.3.290.0100.07314.81
5.3.280.0100.06014.75
5.3.270.0000.05314.84
5.3.260.0070.04714.73
5.3.250.0100.04314.59
5.3.240.0070.04014.73
5.3.230.0100.07714.85
5.3.220.0030.03714.55
5.3.210.0030.05714.73
5.3.200.0070.07314.72
5.3.190.0100.04314.84
5.3.180.0100.07714.70
5.3.170.0100.07314.73
5.3.160.0170.06714.66
5.3.150.0030.06714.70
5.3.140.0030.04014.71
5.3.130.0070.03714.70
5.3.120.0030.08014.80
5.3.110.0070.06314.65
5.3.100.0100.04014.18
5.3.90.0100.06714.11
5.3.80.0070.07014.13
5.3.70.0030.05314.11
5.3.60.0100.06314.25
5.3.50.0070.05714.11
5.3.40.0000.05314.09
5.3.30.0030.05714.16
5.3.20.0030.04713.82
5.3.10.0070.07013.66
5.3.00.0030.06313.68
5.2.170.0070.05311.20
5.2.160.0070.04311.30
5.2.150.0070.03311.39
5.2.140.0100.05711.27
5.2.130.0030.06011.19
5.2.120.0100.05711.24
5.2.110.0100.05711.14
5.2.100.0170.02311.36
5.2.90.0070.03311.21
5.2.80.0070.06011.16
5.2.70.0100.05711.16
5.2.60.0030.06711.14
5.2.50.0070.05711.08
5.2.40.0030.03311.12
5.2.30.0070.03311.05
5.2.20.0030.06311.11
5.2.10.0030.03711.13
5.2.00.0070.06010.80
5.1.60.0030.05310.69
5.1.50.0030.04710.69
5.1.40.0100.04010.69
5.1.30.0000.03010.69
5.1.20.0070.02310.69
5.1.10.0070.02710.69
5.1.00.0030.04710.69
5.0.50.0030.02010.69
5.0.40.0000.05310.69
5.0.30.0000.06310.69
5.0.20.0070.03310.69
5.0.10.0000.04710.69
5.0.00.0070.06310.69
4.4.90.0000.03710.69
4.4.80.0000.03010.69
4.4.70.0000.03710.69
4.4.60.0030.01710.69
4.4.50.0000.01710.69
4.4.40.0000.03710.69
4.4.30.0070.03010.69
4.4.20.0000.01710.69
4.4.10.0030.03010.69
4.4.00.0000.03010.69
4.3.110.0000.02310.69
4.3.100.0030.02710.69
4.3.90.0070.01710.69
4.3.80.0100.04710.69
4.3.70.0000.03710.69
4.3.60.0030.02710.69
4.3.50.0030.03710.69
4.3.40.0070.05010.69
4.3.30.0030.02310.69
4.3.20.0030.01310.69
4.3.10.0000.01710.69
4.3.00.0030.01310.69

preferences:
45.39 ms | 401 KiB | 5 Q