3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getValue($html, $tag, $attr) { $dom = new DOMDocument; $dom->loadHTML($html); $xpath = new DOMXPath($dom); $result = []; foreach ($xpath->query("//{$tag}[@{$attr}]") as $node) { $result[] = $node->getAttribute($attr); } return implode(',', $result); } $html = '<a data-id="777777"></a><a data-id="888888"></a><a data-id="99999"></a>'; $tag = 'a'; $attr = 'data-id'; echo getValue($html, $tag, $attr); echo "\n---\n"; $html = '<a data-A="AAAAAA"></a><a data-A="BBBBBB"></a><a data-A="CCCCCC"></a>'; $tag = 'a'; $attr = 'data-a'; echo getValue($html, $tag, $attr);

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.0130.00721.04
8.5.00.0140.00820.41
8.4.150.0020.00114.05
8.4.140.0100.01218.03
8.4.130.0100.01019.25
8.4.120.0100.01121.12
8.4.110.0040.00519.09
8.4.100.0070.01418.31
8.4.90.0110.01021.11
8.4.80.0080.00721.04
8.4.70.0140.00919.06
8.4.60.0150.00520.60
8.4.50.0050.00419.08
8.4.40.0100.01019.71
8.4.30.0030.00620.77
8.4.20.0150.00618.42
8.4.10.0000.00819.50
8.3.280.0140.00818.76
8.3.270.0090.01016.86
8.3.260.0110.00116.79
8.3.250.0090.00719.05
8.3.240.0100.01017.16
8.3.230.0150.00416.94
8.3.220.0080.00519.55
8.3.210.0060.00316.95
8.3.200.0110.00717.11
8.3.190.0150.00619.39
8.3.180.0130.00619.48
8.3.170.0070.01119.04
8.3.160.0120.00617.35
8.3.150.0070.01417.63
8.3.140.0090.00017.68
8.3.130.0080.00018.80
8.3.120.0100.00620.91
8.3.110.0030.00618.66
8.3.100.0070.00317.04
8.3.90.0130.00626.77
8.3.80.0070.00316.88
8.3.70.0150.00618.68
8.3.60.0100.01318.55
8.3.50.0130.00523.77
8.3.40.0090.00619.05
8.3.30.0040.01119.15
8.3.20.0030.00623.03
8.3.10.0080.00022.26
8.3.00.0060.00322.20
8.2.290.0020.00717.53
8.2.280.0110.00918.88
8.2.270.0100.01017.92
8.2.260.0060.00318.67
8.2.250.0030.00519.29
8.2.240.0050.00317.55
8.2.230.0000.00920.94
8.2.220.0070.00724.06
8.2.210.0040.00426.77
8.2.200.0030.00616.88
8.2.190.0060.00917.00
8.2.180.0080.01119.03
8.2.170.0190.01922.96
8.2.160.0090.00422.64
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00426.16
8.2.110.0060.00320.72
8.2.100.0080.00418.16
8.2.90.0030.00718.13
8.2.80.0000.00819.16
8.2.70.0040.00417.88
8.2.60.0000.00818.30
8.2.50.0040.00418.07
8.2.40.0000.00818.47
8.2.30.0000.01018.50
8.2.20.0080.00018.37
8.2.10.0000.00819.76
8.2.00.0000.00819.69
8.1.330.0150.00516.63
8.1.320.0100.01016.78
8.1.310.0140.00318.74
8.1.300.0110.00719.83
8.1.290.0030.00630.84
8.1.280.0110.00725.92
8.1.270.0000.00822.81
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0040.00419.31
8.1.230.0130.00417.96
8.1.220.0000.00918.04
8.1.210.0050.00318.77
8.1.200.0060.00317.63
8.1.190.0040.00417.48
8.1.180.0000.00818.10
8.1.170.0030.00519.05
8.1.160.0000.00819.27
8.1.150.0030.00621.12
8.1.140.0030.00521.07
8.1.130.0040.00420.37
8.1.120.0040.00417.84
8.1.110.0020.00517.70
8.1.100.0040.00417.79
8.1.90.0000.00717.72
8.1.80.0050.00517.77
8.1.70.0030.00317.82
8.1.60.0050.00517.95
8.1.50.0000.00817.77
8.1.40.0030.00517.89
8.1.30.0060.00318.04
8.1.20.0030.00817.86
8.1.10.0070.00317.96
8.1.00.0050.00317.88
8.0.300.0030.00618.77
8.0.290.0070.00017.25
8.0.280.0030.00318.69
8.0.270.0000.00718.45
8.0.260.0000.00720.45
8.0.250.0030.00317.20
8.0.240.0080.00317.18
8.0.230.0070.00017.31
8.0.220.0070.00017.18
8.0.210.0000.00817.18
8.0.200.0000.00817.34
8.0.190.0040.00417.31
8.0.180.0000.00817.29
8.0.170.0080.00017.21
8.0.160.0040.00417.30
8.0.150.0040.00417.09
8.0.140.0040.00417.19
8.0.130.0000.00613.68
8.0.120.0070.00017.13
8.0.110.0080.00017.27
8.0.100.0040.00417.30
8.0.90.0000.00917.32
8.0.80.0090.00917.10
8.0.70.0040.00417.26
8.0.60.0040.00417.14
8.0.50.0040.00417.19
8.0.30.0070.01017.63
8.0.20.0120.00917.46
8.0.10.0040.00417.28
8.0.00.0130.01317.21
7.4.330.0060.00017.12
7.4.320.0030.00316.86
7.4.300.0000.00616.79
7.4.290.0070.00016.94
7.4.280.0050.00316.95
7.4.270.0070.00016.98
7.4.260.0000.00513.55
7.4.250.0050.00316.85
7.4.240.0030.00616.93
7.4.230.0030.00416.98
7.4.220.0020.00616.98
7.4.210.0090.00917.02
7.4.200.0030.00316.63
7.4.130.0120.00617.04
7.4.120.0130.00716.86
7.4.110.0100.00716.92
7.4.100.0000.02016.77
7.4.90.0030.01616.96
7.4.80.0040.01219.39
7.4.70.0100.00716.72
7.4.60.0170.00016.86
7.4.50.0030.01516.67
7.4.40.0060.01616.88
7.4.10.0030.01414.87
7.4.00.0070.00714.43
7.3.330.0070.00016.71
7.3.320.0000.00513.55
7.3.310.0030.00316.40
7.3.300.0070.00016.59
7.3.290.0090.00816.69
7.3.280.0150.00016.63
7.3.260.0120.00616.95
7.3.240.0100.00716.72
7.3.230.0170.00916.80
7.3.210.0030.01316.83
7.3.200.0070.01316.78
7.3.190.0120.00617.00
7.3.180.0090.00616.92
7.3.170.0160.00316.79
7.3.160.0130.00316.86
7.3.130.0060.00914.96
7.3.120.0130.00014.93
7.3.110.0090.00614.92
7.3.100.0030.01314.87
7.3.90.0030.00914.88
7.3.80.0090.00914.77
7.3.70.0100.00414.91
7.3.60.0000.01414.92
7.3.50.0030.01014.88
7.3.40.0030.01014.72
7.3.30.0100.00314.85
7.3.20.0150.00314.86
7.3.10.0050.00914.67
7.3.00.0060.01015.00
7.2.330.0060.01217.11
7.2.320.0060.01217.06
7.2.310.0060.01616.71
7.2.300.0090.01217.00
7.2.290.0060.01216.87
7.2.260.0080.00815.41
7.2.250.0060.00914.89
7.2.240.0040.01215.23
7.2.230.0060.00915.11
7.2.220.0030.01315.30
7.2.210.0040.01414.99
7.2.200.0060.01014.98
7.2.190.0070.01015.01
7.2.180.0110.00315.03
7.2.170.0110.00414.98
7.2.160.0000.01614.99
7.2.150.0000.01415.20
7.2.140.0030.01015.25
7.2.130.0120.00314.88
7.2.120.0060.00915.17
7.2.110.0060.01014.80
7.2.100.0110.00515.13
7.2.90.0120.00914.88
7.2.80.0130.00314.87
7.2.70.0100.00615.13
7.2.60.0060.00915.14
7.2.50.0120.00614.93
7.2.40.0110.00815.13
7.2.30.0120.00815.20
7.2.20.0000.01815.29
7.2.10.0100.01015.03
7.2.00.0060.00915.25

preferences:
181.45 ms | 403 KiB | 5 Q