3v4l.org

run code in 300+ PHP versions simultaneously
<?php $article = '<html><body><div>some text</div><iframe name="notyoutube" src="http://example.com"></iframe><p>some more text</p> <iframe width="560" height="315" src="https://www.youtube.com/embed/bpcNPHqs4ng" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><div>one last div</div></body></html>'; $doc = new DOMDocument(); $doc->loadHTML($article, LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($doc); foreach ($xpath->query("//iframe[contains(@src, 'youtube')]") as $youtube) { // create a new node $node = $doc->createElement('amp-youtube'); // set attributes $node->setAttribute('data-videoid', basename(parse_url($youtube->getAttribute('src'), PHP_URL_PATH))); $node->setAttribute('width', $youtube->getAttribute('width')); $node->setAttribute('height', $youtube->getAttribute('height')); $node->setAttribute('layout', 'responsive'); // and now replace the old node $youtube->parentNode->replaceChild($node, $youtube); } echo $doc->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.5.10.0120.00616.92
8.5.00.0040.00920.27
8.4.150.0000.00214.05
8.4.140.0150.01417.81
8.4.130.0160.00519.05
8.4.120.0080.00724.52
8.4.110.0140.00719.13
8.4.100.0130.00719.09
8.4.90.0120.01121.06
8.4.80.0060.00319.21
8.4.70.0050.00418.38
8.4.60.0140.00618.96
8.4.50.0040.00518.90
8.4.40.0030.01719.86
8.4.30.0180.00322.63
8.4.20.0090.01219.05
8.4.10.0100.00619.77
8.3.280.0160.00818.74
8.3.270.0110.00817.05
8.3.260.0110.00916.95
8.3.250.0090.00719.44
8.3.240.0080.01117.46
8.3.230.0120.00516.93
8.3.220.0050.01119.17
8.3.210.0130.00616.85
8.3.200.0050.00416.85
8.3.190.0040.00517.43
8.3.180.0070.00417.66
8.3.170.0040.00419.36
8.3.160.0090.00916.79
8.3.150.0140.00717.86
8.3.140.0120.00619.04
8.3.130.0030.01316.90
8.3.120.0100.00019.28
8.3.110.0040.00420.94
8.3.100.0050.00324.06
8.3.90.0110.00426.77
8.3.80.0060.00318.68
8.3.70.0120.00316.88
8.3.60.0040.01118.68
8.3.50.0060.00718.13
8.3.40.0060.01319.18
8.3.30.0030.01218.92
8.3.20.0050.00320.93
8.3.10.0030.00620.71
8.3.00.0030.00521.15
8.2.290.0110.00820.88
8.2.280.0060.00318.79
8.2.270.0110.00717.42
8.2.260.0030.00617.11
8.2.250.0000.00817.33
8.2.240.0130.00317.69
8.2.230.0090.00022.58
8.2.220.0060.00337.54
8.2.210.0050.00326.77
8.2.200.0100.00016.88
8.2.190.0100.01017.12
8.2.180.0070.01418.48
8.2.170.0110.00722.96
8.2.160.0070.00720.72
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00818.34
8.2.120.0080.00026.35
8.2.110.0090.00020.70
8.2.100.0070.00418.05
8.2.90.0030.00518.09
8.2.80.0030.00518.18
8.2.70.0030.00618.30
8.2.60.0080.00018.59
8.2.50.0080.00018.10
8.2.40.0040.00419.59
8.2.30.0060.00619.26
8.2.20.0070.00318.27
8.2.10.0040.00419.97
8.2.00.0040.00418.38
8.1.330.0140.00622.13
8.1.320.0080.00718.32
8.1.310.0070.00718.70
8.1.300.0040.00418.86
8.1.290.0060.00330.84
8.1.280.0110.00725.92
8.1.270.0080.00020.61
8.1.260.0000.00726.35
8.1.250.0050.00328.09
8.1.240.0030.00624.18
8.1.230.0040.00722.58
8.1.220.0030.00518.04
8.1.210.0040.00419.14
8.1.200.0030.00617.72
8.1.190.0040.00417.63
8.1.180.0040.00418.10
8.1.170.0080.00018.97
8.1.160.0050.00319.34
8.1.150.0040.00419.19
8.1.140.0000.00720.52
8.1.130.0000.00717.80
8.1.120.0000.00717.75
8.1.110.0050.00317.72
8.1.100.0040.00417.71
8.1.90.0040.00417.67
8.1.80.0030.00517.83
8.1.70.0000.01117.82
8.1.60.0050.00317.99
8.1.50.0060.00317.77
8.1.40.0030.00617.82
8.1.30.0000.00917.86
8.1.20.0000.00818.03
8.1.10.0040.00417.85
8.1.00.0060.00317.89
8.0.300.0040.00420.57
8.0.290.0100.00017.13
8.0.280.0040.00418.87
8.0.270.0030.00317.56
8.0.260.0080.00017.27
8.0.250.0070.00317.38
8.0.240.0040.00417.21
8.0.230.0000.00717.34
8.0.220.0000.00817.30
8.0.210.0030.00317.15
8.0.200.0040.00217.23
8.0.190.0030.00517.23
8.0.180.0000.00817.25
8.0.170.0060.00317.29
8.0.160.0070.00317.25
8.0.150.0020.00517.23
8.0.140.0040.00417.12
8.0.130.0000.00613.70
8.0.120.0040.00417.28
8.0.110.0070.00017.07
8.0.100.0030.00617.31
8.0.90.0060.00317.17
8.0.80.0030.01217.27
8.0.70.0020.00517.18
8.0.60.0040.00417.16
8.0.50.0000.00817.31
8.0.30.0120.01017.33
8.0.20.0160.00617.44
8.0.10.0170.00317.36
8.0.00.0110.00817.24
7.4.330.0000.00615.55
7.4.320.0040.00416.94
7.4.300.0030.00316.87
7.4.290.0000.00816.99
7.4.280.0030.00616.85
7.4.270.0030.00316.86
7.4.260.0080.00016.81
7.4.250.0000.00816.89
7.4.240.0030.00316.88
7.4.230.0040.00417.01
7.4.220.0040.00417.07
7.4.210.0090.00916.82
7.4.200.0040.00417.01
7.4.160.0070.01116.80
7.4.150.0000.01816.68
7.4.140.0070.01417.39
7.4.130.0070.01416.77
7.4.120.0100.01216.69
7.4.110.0130.01016.80
7.4.100.0110.01016.78
7.4.90.0080.00916.81
7.4.80.0170.00218.02
7.4.70.0070.01016.71
7.4.60.0060.01116.94
7.4.50.0060.00616.75
7.4.40.0070.01016.77
7.4.30.0060.01216.65
7.4.20.0090.00916.82
7.4.10.0090.00815.95
7.4.00.0070.01215.58
7.3.330.0000.00513.28
7.3.320.0000.00513.45
7.3.310.0000.00716.61
7.3.300.0000.00716.53
7.3.290.0030.00316.40
7.3.280.0080.00716.53
7.3.270.0090.00916.68
7.3.260.0090.01116.79
7.3.250.0060.01116.56
7.3.240.0060.01316.69
7.3.230.0100.00816.77
7.3.220.0150.00916.81
7.3.210.0100.00816.79
7.3.200.0090.00816.62
7.3.190.0110.00916.69
7.3.180.0120.00616.73
7.3.170.0100.01016.67
7.3.160.0070.01116.84
7.3.150.0120.00616.70
7.3.140.0140.00416.89
7.3.130.0090.00815.84
7.3.120.0100.00915.76
7.3.110.0080.01115.74
7.3.100.0060.00915.96
7.3.90.0110.00615.71
7.3.80.0120.00415.79
7.3.70.0030.01115.86
7.3.60.0080.00915.38
7.3.50.0090.00415.42
7.3.40.0050.01015.49
7.3.30.0100.00815.13
7.3.20.0470.01015.54
7.3.10.0520.00915.42
7.3.00.0470.00715.44
7.2.340.0140.00716.89
7.2.330.0090.01317.14
7.2.320.0130.00616.89
7.2.310.0110.00617.03
7.2.300.0080.01116.75
7.2.290.0160.00517.00
7.2.280.0060.01217.07
7.2.270.0160.00316.93
7.2.260.0100.00915.88
7.2.250.0100.00916.10
7.2.240.0060.01016.23
7.2.230.0100.00516.04
7.2.220.0030.01216.12
7.2.210.0050.01216.09
7.2.200.0070.01016.07
7.2.190.0110.00815.76
7.2.180.0070.00915.79
7.2.170.0060.01115.72
7.2.160.0110.00815.74
7.2.150.0420.00915.79
7.2.140.0520.00715.81
7.2.130.0420.00915.82
7.2.120.0480.00915.79
7.2.110.0420.00916.05
7.2.100.0500.00815.99
7.2.90.0490.00716.16
7.2.80.0430.00916.11
7.2.70.0740.00816.10
7.2.60.0470.00716.03
7.2.50.0480.01016.08
7.2.40.0560.00916.06
7.2.30.0600.00716.05
7.2.20.0450.00916.02
7.2.10.0240.01016.00
7.2.00.0250.00816.02
7.1.330.0030.01415.93
7.1.320.0060.01116.02
7.1.310.0070.00815.92
7.1.300.0070.00915.29
7.1.290.0080.00815.24
7.1.280.0100.00715.34
7.1.270.0130.00814.86
7.1.260.0170.00814.91
7.1.250.0430.00914.68
7.1.240.0080.01015.91
7.1.230.0120.00715.94
7.1.220.0100.01115.74
7.1.210.0080.00915.86
7.1.200.0050.01115.97
7.1.190.0110.00715.65
7.1.180.0080.00715.76
7.1.170.0120.00715.88
7.1.160.0070.01515.96
7.1.150.0100.01015.67
7.1.140.0230.00915.67
7.1.130.0150.00515.80
7.1.120.0110.00815.80
7.1.110.0050.01015.75
7.1.100.0070.01015.68
7.1.90.0100.00615.80
7.1.80.0080.01315.78
7.1.70.0070.01315.71
7.1.60.0170.01115.72
7.1.50.0050.00915.91
7.1.40.0090.00515.87
7.1.30.0080.00716.01
7.1.20.0110.00615.88
7.1.10.0080.00915.78
7.1.00.0030.01015.61
5.6.00.0070.00415.93
5.5.90.0090.00315.86

preferences:
36.06 ms | 403 KiB | 5 Q