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(); } $attribs = [ ['style' => '"border:1px solid black;"'] ]; addElement($doc, 'ul', 'select', $attribs);

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.0040.01118.68
8.3.50.0110.00723.02
8.3.40.0060.01219.00
8.3.30.0120.00319.22
8.3.20.0090.00021.96
8.3.10.0040.00423.87
8.3.00.0080.00020.23
8.2.180.0140.00316.88
8.2.170.0110.00722.96
8.2.160.0110.00421.34
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00022.33
8.2.120.0080.00026.35
8.2.110.0190.00319.39
8.2.100.0030.01018.09
8.2.90.0000.00819.46
8.2.80.0090.00017.97
8.2.70.0080.00017.75
8.2.60.0000.00918.29
8.2.50.0000.00918.10
8.2.40.0000.00822.58
8.2.30.0040.00419.55
8.2.20.0000.00718.03
8.2.10.0000.00718.37
8.2.00.0040.00418.36
8.1.280.0120.00325.92
8.1.270.0040.00424.22
8.1.260.0070.00028.09
8.1.250.0040.00428.09
8.1.240.0180.00424.04
8.1.230.0090.00321.10
8.1.220.0040.00417.79
8.1.210.0060.00318.77
8.1.200.0060.00317.48
8.1.190.0040.00417.61
8.1.180.0040.00418.10
8.1.170.0040.00418.78
8.1.160.0000.00722.24
8.1.150.0000.00821.12
8.1.140.0070.00019.75
8.1.130.0000.00717.97
8.1.120.0050.00317.70
8.1.110.0040.00417.68
8.1.100.0030.00517.68
8.1.90.0040.00417.77
8.1.80.0040.00417.75
8.1.70.0000.00717.66
8.1.60.0030.00617.78
8.1.50.0030.00617.70
8.1.40.0030.00617.75
8.1.30.0050.00417.88
8.1.20.0040.00417.87
8.1.10.0040.00417.83
8.1.00.0040.00417.68
8.0.300.0030.00620.15
8.0.290.0050.00217.13
8.0.280.0040.00418.73
8.0.270.0030.00317.43
8.0.260.0030.00317.50
8.0.250.0040.00417.23
8.0.240.0000.00817.21
8.0.230.0030.00317.18
8.0.220.0000.00717.19
8.0.210.0000.00717.17
8.0.200.0030.00317.34
8.0.190.0050.00317.28
8.0.180.0040.00417.19
8.0.170.0030.00617.16
8.0.160.0050.00317.23
8.0.150.0050.00217.20
8.0.140.0000.00717.11
8.0.130.0000.00613.65
8.0.120.0090.00017.14
8.0.110.0030.00517.20
8.0.100.0030.00517.02
8.0.90.0080.00017.27
8.0.80.0090.00617.25
8.0.70.0070.00017.08
8.0.60.0040.00417.27
8.0.50.0040.00417.12
8.0.30.0100.01017.35
8.0.20.0100.00917.49
8.0.10.0040.00717.30
8.0.00.0110.00717.11
7.4.330.0060.00015.08
7.4.320.0040.00416.71
7.4.300.0040.01116.61
7.4.290.0050.00516.66
7.4.280.0110.00016.60
7.4.270.0080.00316.73
7.4.260.0040.00716.71
7.4.250.0040.00416.48
7.4.240.0040.00716.73
7.4.230.0030.00616.79
7.4.220.0090.02216.59
7.4.210.0210.00716.59
7.4.200.0030.00616.63
7.4.160.0420.02516.78
7.4.150.0350.01617.40
7.4.140.0230.02117.86
7.4.130.0320.01116.87
7.4.120.0150.01616.72
7.4.110.0550.01016.66
7.4.100.0400.01416.75
7.4.90.0100.01816.89
7.4.80.0130.01319.39
7.4.70.0400.01816.68
7.4.60.0300.01316.52
7.4.50.0080.00816.85
7.4.40.0700.02716.88
7.4.30.0210.00816.77
7.4.00.0110.01114.83
7.3.330.0040.00413.51
7.3.320.0040.00413.61
7.3.310.0000.00916.58
7.3.300.0050.00516.63
7.3.290.0140.03116.61
7.3.280.0120.01716.55
7.3.270.0430.02217.40
7.3.260.0330.00916.62
7.3.250.0290.01416.65
7.3.240.0250.01416.68
7.3.230.0430.01216.70
7.3.210.0970.01716.83
7.3.200.0410.01616.68
7.3.190.0720.01316.56
7.3.180.0130.01016.49
7.3.170.0540.02416.61
7.3.160.0370.01116.59
7.2.330.0230.01117.03
7.2.320.0910.02817.07
7.2.310.0730.02616.78
7.2.300.0060.01917.16
7.2.290.0930.03316.99
7.2.110.0170.02016.44
7.2.60.0000.01316.70
7.2.00.0040.01519.41
7.1.200.0040.01315.80
7.1.100.0040.01118.05
7.1.70.0060.00916.96
7.1.60.0000.01219.75
7.1.50.0090.00916.86
7.1.00.0100.07322.39
7.0.200.0320.00914.80
7.0.90.0770.00020.03
7.0.80.0800.00020.08
7.0.70.0770.00020.16
7.0.60.0870.00020.19
7.0.50.0800.00020.54
7.0.40.1000.00020.52
7.0.30.0900.00020.56
7.0.20.0870.00020.55
7.0.10.0800.00020.46
7.0.00.0770.00020.41
5.6.240.0770.00020.69
5.6.230.0770.00020.78
5.6.220.0770.00020.64
5.6.210.0970.00020.83
5.6.200.0770.00021.19
5.6.190.0830.00021.18
5.6.180.0770.00021.25
5.6.170.0770.00021.27
5.6.160.0770.00021.17
5.6.150.0800.00021.26
5.6.140.0730.00021.27
5.6.130.0770.00021.25
5.6.120.0900.00021.27
5.6.110.1000.00021.14
5.6.100.0770.00021.20
5.6.90.0770.00021.23
5.6.80.1030.00020.64
5.6.70.0800.00020.55
5.6.60.0730.00020.50
5.6.50.0930.00020.66
5.6.40.0730.00020.54
5.6.30.0670.00020.52
5.6.20.0670.00020.47
5.6.10.0830.00020.47
5.6.00.0630.00020.59

preferences:
59.18 ms | 401 KiB | 5 Q