3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument(); $doc->loadHTML('<html><body><a href="teste.php">Teste</a><a href="../teste2.php">Teste2</a></body></html>'); $links = $doc->getElementsByTagName('a'); print_r($links); foreach($links as $link) { echo $link->getAttribute('href') . "\n"; } echo $doc->saveHTML() . "\n\n"; $body = $doc->getElementsByTagName('body')[0]; $select = $doc->createElement('select'); $body->appendChild($select); echo $doc->saveHTML() . "\n\n"; function addElement($doc, $newElement, $parentElement, $attributesArray = null) { $pe = $doc->getElementsByTagName($parentElement)[0]; $ne = $doc->createElement($newElement); $pe->appendChild($ne); if (isset($attributesArray)) { while ( ($current = current($attributesArray)) ) { print_r($current); $attrib = key($current); $domAttribute = $doc->createAttribute($attrib); // Value for the created attribute $domAttribute->value = $current[$attrib]; // Don't forget to append it to the element $ne->appendChild($domAttribute); echo $attrib . '=' . $current[$attrib] . "\n"; next($array); } } echo $doc->saveHTML(); } addElement($doc, 'ul', 'select');

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.70.0110.00718.53
8.3.60.0000.01518.40
8.3.50.0130.00723.06
8.3.40.0110.00418.78
8.3.30.0140.00018.83
8.3.20.0030.00522.16
8.3.10.0080.00022.07
8.3.00.0030.00520.10
8.2.180.0170.00016.75
8.2.170.0120.00322.96
8.2.160.0100.00321.27
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0050.00322.51
8.2.120.0050.00326.35
8.2.110.0070.00320.96
8.2.100.0090.00318.32
8.2.90.0030.00519.51
8.2.80.0050.00318.00
8.2.70.0000.00817.88
8.2.60.0080.00018.05
8.2.50.0030.00618.10
8.2.40.0040.00422.40
8.2.30.0000.00719.55
8.2.20.0050.00317.91
8.2.10.0050.00318.23
8.2.00.0000.00718.30
8.1.280.0110.00425.92
8.1.270.0030.00624.13
8.1.260.0070.00028.09
8.1.250.0060.00328.09
8.1.240.0000.00924.09
8.1.230.0070.00717.89
8.1.220.0030.00518.04
8.1.210.0030.00618.77
8.1.200.0060.00317.48
8.1.190.0050.00317.35
8.1.180.0050.00318.10
8.1.170.0000.00818.64
8.1.160.0070.00022.45
8.1.150.0040.00421.10
8.1.140.0000.00819.89
8.1.130.0000.00717.95
8.1.120.0040.00417.75
8.1.110.0040.00417.64
8.1.100.0000.00817.68
8.1.90.0030.00517.76
8.1.80.0040.00417.68
8.1.70.0000.00717.76
8.1.60.0060.00317.83
8.1.50.0060.00317.78
8.1.40.0030.00617.72
8.1.30.0030.00517.85
8.1.20.0030.00517.84
8.1.10.0000.00817.86
8.1.00.0040.00417.70
8.0.300.0040.00418.77
8.0.290.0030.00616.88
8.0.280.0030.00318.61
8.0.270.0040.00317.44
8.0.260.0000.00717.43
8.0.250.0040.00417.19
8.0.240.0060.00317.18
8.0.230.0030.00317.19
8.0.220.0040.00417.02
8.0.210.0050.00217.07
8.0.200.0070.00017.07
8.0.190.0030.00617.19
8.0.180.0040.00417.13
8.0.170.0070.00017.22
8.0.160.0070.00017.07
8.0.150.0000.00717.00
8.0.140.0040.00417.10
8.0.130.0030.00313.55
8.0.120.0040.00417.13
8.0.110.0030.00617.00
8.0.100.0000.00817.14
8.0.90.0080.00017.03
8.0.80.0060.00917.25
8.0.70.0040.00417.28
8.0.60.0030.00517.27
8.0.50.0040.00416.86
8.0.30.0100.01017.35
8.0.20.0090.00917.47
8.0.10.0090.00017.23
8.0.00.0070.01117.11
7.4.330.0000.00515.08
7.4.320.0030.00316.91
7.4.300.0000.00716.71
7.4.290.0030.00316.72
7.4.280.0040.00416.92
7.4.270.0070.00016.81
7.4.260.0000.00816.81
7.4.250.0040.00416.77
7.4.240.0050.00316.92
7.4.230.0030.00316.60
7.4.220.0100.01016.94
7.4.210.0060.00916.71
7.4.200.0000.00816.89
7.4.160.0110.00716.89
7.4.150.0090.00917.40
7.4.140.0080.01017.86
7.4.130.0140.00516.78
7.4.120.0080.01216.76
7.4.110.0060.01116.84
7.4.100.0070.01116.74
7.4.90.0080.01016.63
7.4.80.0130.00419.39
7.4.70.0050.01116.73
7.4.60.0110.00616.68
7.4.50.0000.01716.77
7.4.40.0060.01116.58
7.4.30.0060.01016.89
7.4.00.0040.01115.00
7.3.330.0050.00013.52
7.3.320.0030.00313.58
7.3.310.0030.00316.41
7.3.300.0000.00716.68
7.3.290.0060.01016.55
7.3.280.0080.01016.66
7.3.270.0110.00817.40
7.3.260.0140.00716.68
7.3.250.0080.01016.68
7.3.240.0130.00816.63
7.3.230.0090.00816.79
7.3.210.0030.01516.83
7.3.200.0120.00616.74
7.3.190.0080.00816.55
7.3.180.0070.01016.54
7.3.170.0060.01216.67
7.3.160.0140.00716.78
7.3.120.0070.01014.93
7.3.110.0110.00714.89
7.3.100.0120.00615.11
7.3.90.0070.00614.86
7.3.80.0060.00915.15
7.3.70.0030.00614.81
7.3.60.0040.00714.96
7.3.50.0060.00315.03
7.3.40.0040.01114.94
7.3.30.0050.00514.77
7.3.20.0150.00016.63
7.3.10.0090.00616.88
7.3.00.0040.01416.66
7.2.330.0150.00316.96
7.2.320.0120.00816.75
7.2.310.0190.00316.80
7.2.300.0130.01016.99
7.2.290.0080.00817.07
7.2.250.0060.01315.24
7.2.240.0100.00715.36
7.2.230.0100.01015.29
7.2.220.0030.01015.31
7.2.210.0070.00415.15
7.2.200.0070.00715.21
7.2.190.0100.00315.08
7.2.180.0030.01215.07
7.2.170.0060.00915.07
7.2.60.0170.00316.98
7.2.50.0090.00616.81
7.1.330.0060.01015.95
7.1.320.0030.01015.79
7.1.310.0030.00615.61
7.1.300.0080.00615.93
7.1.290.0040.01115.81
7.1.280.0060.00915.92
7.1.270.0030.01316.00
7.1.260.0040.01415.96
7.1.200.0070.00315.83
7.1.70.0030.01217.16
7.1.60.0000.01419.75
7.1.50.0060.01217.04
7.1.00.0100.07022.43
7.0.200.0820.00014.97
7.0.90.0800.00020.09
7.0.80.0700.00020.12
7.0.70.0670.00019.94
7.0.60.0670.00020.00
7.0.50.0800.00020.45
7.0.40.0700.00020.48
7.0.30.0700.00020.39
7.0.20.0970.00020.50
7.0.10.0930.00020.39
7.0.00.0700.00020.51
5.6.240.0730.00020.72
5.6.230.0730.00020.65
5.6.220.0770.00020.70
5.6.210.0670.00020.77
5.6.200.0770.00021.17
5.6.190.0800.00021.24
5.6.180.0670.00021.23
5.6.170.0670.00021.23
5.6.160.0700.00021.23
5.6.150.0930.00021.14
5.6.140.0730.00021.20
5.6.130.0830.00021.21
5.6.120.0730.00021.13
5.6.110.0770.00021.13
5.6.100.0800.00021.13
5.6.90.0830.00021.13
5.6.80.0730.00020.54
5.6.70.0700.00020.59
5.6.60.0700.00020.62
5.6.50.0670.00020.50
5.6.40.0700.00020.47
5.6.30.0700.00020.49
5.6.20.0630.00020.49
5.6.10.0670.00020.47
5.6.00.0670.00020.48

preferences:
52.68 ms | 401 KiB | 5 Q