3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<div class='parent'> <div class='title'>A Title</div> <div class='child'>some text</div> <div class='child'>some text</div> <div class='title'>A Title</div> <div class='child'>some text</div> <div class='child'>some text</div> </div>"; $dom = new DOMDocument(); $dom->loadHTML($xml); //$dom->loadXML($xml); $xpath = new DOMXPath($dom); $xpqueries = array( "//div[@class='parent']/div", "//div[@class='xparent']/div", // "comment()[last()]", // "/comment()[last()]", // "//comment()[last()]" ); foreach ($xpqueries as $xpquery) { $dnode = $xpath->query($xpquery); if ($dnode && $dnode->length > 0) { echo "query '{$xpquery}' results in {$dnode->length} nodes. '" . htmlentities($dnode->item(0)->nodeValue) . "' is the first item, '" . htmlentities($dnode->item($dnode->length - 1)->nodeValue) . "' is the last.<br />"; } else { echo "query '{$xpquery}' results in {$dnode->length} nodes.<br />"; } } return;

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.0110.01118.58
8.3.50.0100.01022.17
8.3.40.0060.00919.00
8.3.30.0130.00319.42
8.3.20.0040.00420.54
8.3.10.0080.00023.81
8.3.00.0090.00019.26
8.2.180.0070.00718.79
8.2.170.0120.00922.96
8.2.160.0100.00320.72
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0060.00326.16
8.2.120.0080.00021.35
8.2.110.0070.01419.58
8.2.100.0060.00619.52
8.2.90.0090.00018.00
8.2.80.0000.00920.04
8.2.70.0040.00418.41
8.2.60.0000.00818.34
8.2.50.0090.00018.10
8.2.40.0000.00819.73
8.2.30.0040.00418.59
8.2.20.0050.00318.03
8.2.10.0030.00518.37
8.2.00.0030.00618.18
8.1.280.0110.00425.92
8.1.270.0030.00524.35
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0040.00424.26
8.1.230.0060.00622.31
8.1.220.0080.00018.04
8.1.210.0000.00818.77
8.1.200.0090.00017.73
8.1.190.0080.00017.60
8.1.180.0060.00318.10
8.1.170.0080.00018.86
8.1.160.0030.00522.34
8.1.150.0000.00719.02
8.1.140.0000.00917.80
8.1.130.0000.00718.30
8.1.120.0000.00717.86
8.1.110.0000.00717.82
8.1.100.0050.00317.63
8.1.90.0030.00517.86
8.1.80.0030.00517.68
8.1.70.0020.00517.70
8.1.60.0000.00817.85
8.1.50.0030.00617.88
8.1.40.0070.00017.89
8.1.30.0060.00317.91
8.1.20.0040.00417.89
8.1.10.0070.00017.96
8.1.00.0040.00417.92
8.0.300.0040.00419.80
8.0.290.0080.00017.00
8.0.280.0000.00718.83
8.0.270.0000.00717.56
8.0.260.0030.00317.55
8.0.250.0070.00017.18
8.0.240.0030.00317.25
8.0.230.0030.00317.32
8.0.220.0040.00417.25
8.0.210.0000.00717.14
8.0.200.0030.00317.35
8.0.190.0090.00017.35
8.0.180.0040.00417.30
8.0.170.0030.00517.21
8.0.160.0040.00417.21
8.0.150.0000.00817.09
8.0.140.0050.00217.24
8.0.130.0000.00613.63
8.0.120.0080.00017.05
8.0.110.0000.00817.15
8.0.100.0030.00517.00
8.0.90.0000.00717.22
8.0.80.0130.00317.31
8.0.70.0000.00817.21
8.0.60.0030.00517.12
8.0.50.0080.00017.09
8.0.30.0110.00817.44
8.0.20.0080.01017.51
8.0.10.0000.00717.29
8.0.00.0130.00617.14
7.4.330.0030.00315.30
7.4.320.0060.00016.94
7.4.300.0060.00016.96
7.4.290.0030.00316.90
7.4.280.0000.00716.88
7.4.270.0040.00416.79
7.4.260.0040.00416.90
7.4.250.0040.00316.84
7.4.240.0040.00316.93
7.4.230.0070.00016.88
7.4.220.0160.00717.09
7.4.210.0080.00616.89
7.4.200.0070.00016.89
7.4.190.0030.00516.88
7.4.160.0160.00616.77
7.4.150.0070.01017.40
7.4.140.0100.00717.86
7.4.130.0100.00816.89
7.4.120.0090.00816.88
7.4.110.0100.00716.69
7.4.100.0070.01016.77
7.4.90.0090.00916.91
7.4.80.0070.01119.39
7.4.70.0110.00616.86
7.4.60.0070.01016.96
7.4.50.0090.00016.86
7.4.40.0100.00816.79
7.4.30.0120.00416.83
7.4.10.0070.01015.24
7.4.00.0050.01015.15
7.3.330.0050.00013.55
7.3.320.0000.00613.32
7.3.310.0040.00416.70
7.3.300.0030.00316.64
7.3.290.0110.00616.68
7.3.280.0060.01216.71
7.3.270.0200.00317.40
7.3.260.0050.01616.69
7.3.250.0120.01116.77
7.3.240.0070.01016.69
7.3.230.0110.00616.68
7.3.210.0140.00316.66
7.3.200.0150.00919.39
7.3.190.0100.01016.73
7.3.180.0170.00316.58
7.3.170.0090.00616.94
7.3.160.0150.00016.54
7.3.130.0060.01115.20
7.3.120.0020.01515.08
7.3.110.0140.00315.15
7.3.100.0090.00614.95
7.3.90.0030.01014.96
7.3.80.0060.00615.01
7.3.70.0040.01114.75
7.3.60.0040.00414.91
7.3.50.0000.00815.09
7.3.40.0100.00315.02
7.3.30.0120.00314.96
7.3.20.0060.00916.92
7.3.10.0070.00316.80
7.3.00.0030.00616.68
7.2.330.0030.01417.13
7.2.320.0150.00917.13
7.2.310.0190.00616.94
7.2.300.0070.01717.06
7.2.290.0070.01417.16
7.2.260.0070.01115.13
7.2.250.0120.00615.14
7.2.240.0000.01515.10
7.2.230.0060.00914.95
7.2.220.0060.00915.23
7.2.210.0000.01015.17
7.2.200.0070.01015.30
7.2.190.0030.00915.26
7.2.180.0060.00315.41
7.2.170.0000.01315.25
7.2.160.0070.00715.21
7.2.150.0090.00317.02
7.2.140.0000.01817.23
7.2.130.0080.00816.88
7.2.120.0100.00616.94
7.2.110.0030.00617.10
7.2.100.0070.00716.93
7.2.90.0030.01017.18
7.2.80.0030.00617.14
7.2.70.0030.00717.04
7.2.60.0110.00217.10
7.2.50.0000.00917.28
7.2.40.0040.01117.08
7.2.30.0040.00917.23
7.2.20.0030.01217.17
7.2.10.0030.00917.27
7.2.00.0030.01017.16
7.1.330.0090.00315.93
7.1.320.0000.01616.00
7.1.310.0040.01115.98
7.1.300.0080.00415.94
7.1.290.0000.00915.89
7.1.280.0000.00816.22
7.1.270.0000.01215.91
7.1.260.0060.00615.89
7.1.250.0060.00615.87
7.1.240.0000.01115.95
7.1.230.0080.00015.85
7.1.220.0070.00715.83
7.1.210.0030.00615.80
7.1.200.0060.00616.00
7.1.190.0080.00416.09
7.1.180.0090.00316.01
7.1.170.0070.00716.18
7.1.160.0070.00715.89
7.1.150.0030.01216.01
7.1.140.0000.00815.96
7.1.130.0030.01016.13
7.1.120.0000.01415.88
7.1.110.0050.00515.71
7.1.100.0040.00815.91
7.1.90.0030.01015.95
7.1.80.0060.00315.77
7.1.70.0050.00816.72
7.1.60.0080.00817.64
7.1.50.0050.00916.63
7.1.40.0070.00715.71
7.1.30.0040.00716.17
7.1.20.0060.00616.00
7.1.10.0090.00915.99
7.1.00.0020.04319.28
7.0.330.0030.01215.54
7.0.320.0080.00015.53
7.0.310.0060.00615.36
7.0.300.0000.00815.56
7.0.290.0060.00615.54
7.0.280.0000.00815.83
7.0.270.0000.00715.75
7.0.260.0030.01015.73
7.0.250.0030.00615.59
7.0.240.0100.00615.68
7.0.230.0060.00615.54
7.0.220.0000.00815.62
7.0.210.0000.01015.69
7.0.200.0030.00716.24
7.0.190.0040.00715.35
7.0.180.0100.00015.55
7.0.170.0000.00815.78
7.0.160.0040.00815.51
7.0.150.0000.01415.64
7.0.140.0020.04418.97
7.0.130.0030.01215.79
7.0.120.0000.00815.57
7.0.110.0070.00715.50
7.0.100.0030.00615.33
7.0.90.0000.01315.30
7.0.80.0070.00315.56
7.0.70.0000.01415.69
7.0.60.0050.02217.82
7.0.50.0050.02416.92
7.0.40.0030.02816.99
7.0.30.0250.03817.07
7.0.20.0070.02816.96
7.0.10.0100.04317.02
7.0.00.0050.04816.98
5.6.400.0030.01014.57
5.6.390.0030.01014.65
5.6.380.0060.00614.22
5.6.370.0000.01114.80
5.6.360.0110.00314.59
5.6.350.0110.00314.21
5.6.340.0030.00614.73
5.6.330.0080.00714.23
5.6.320.0070.00314.61
5.6.310.0030.00914.62
5.6.300.0060.01214.52
5.6.290.0030.01014.52
5.6.280.0070.00714.41
5.6.270.0060.00614.45
5.6.260.0030.01014.78
5.6.250.0040.00814.52
5.6.240.0030.01014.43
5.6.230.0030.01014.45
5.6.220.0060.00914.42
5.6.210.0080.04317.59
5.6.200.0050.04616.35
5.6.190.0060.03017.53
5.6.180.0140.02917.47
5.6.170.0210.02317.53
5.6.160.0060.03317.39
5.6.150.0030.04616.49
5.6.140.0030.04516.30
5.6.130.0120.04116.50
5.6.120.0050.04717.82
5.6.110.0080.04017.79
5.6.100.0070.03617.74
5.6.90.0120.03517.69
5.6.80.0070.04017.48
5.6.70.0090.00914.33
5.6.60.0070.00714.47
5.6.50.0000.01314.46
5.6.40.0030.01114.28
5.6.30.0120.00014.71
5.6.20.0030.01014.35
5.6.10.0080.00014.28
5.6.00.0040.00814.34
5.5.380.0100.00714.23
5.5.370.0040.01114.65
5.5.360.0000.01314.65
5.5.350.0040.02417.59
5.5.340.0060.02116.26
5.5.330.0070.04117.37
5.5.320.0100.02717.50
5.5.310.0120.02917.52
5.5.300.0030.03316.14
5.5.290.0070.02716.27
5.5.280.0050.04717.71
5.5.270.0060.03617.67
5.5.260.0030.04617.82
5.5.250.0070.04717.41
5.5.240.0140.02917.36
5.5.230.0000.01414.37
5.5.220.0030.00614.38
5.5.210.0000.00914.46
5.5.200.0000.01114.32
5.5.190.0030.00914.45
5.5.180.0070.00714.26
5.5.170.0030.00514.53
5.5.160.0000.01314.59
5.5.150.0100.00314.16
5.5.140.0000.01214.37
5.5.130.0030.01014.32
5.5.120.0040.00814.05
5.5.110.0040.01114.50
5.5.100.0080.00314.63
5.5.90.0030.00714.59
5.5.80.0040.01114.29
5.5.70.0030.01014.38
5.5.60.0030.00714.53
5.5.50.0040.00714.27
5.5.40.0070.00714.48
5.5.30.0040.01114.12
5.5.20.0000.01214.31
5.5.10.0060.00614.30
5.5.00.0030.01014.10
5.4.450.0280.03016.12
5.4.440.0410.03516.19
5.4.430.0370.03215.98
5.4.420.0380.03215.94
5.4.410.0470.03516.13
5.4.400.0430.03015.96
5.4.390.0550.03115.83
5.4.380.0220.02115.74
5.4.370.0100.02715.73
5.4.360.0120.02215.73
5.4.350.0060.02512.40
5.4.340.0050.02112.39
5.4.330.0040.00812.57
5.4.320.0060.02112.64
5.4.310.0040.02312.64
5.4.300.0060.01912.64
5.4.290.0060.02312.64
5.4.280.0080.01512.59
5.4.270.0030.02312.59
5.4.260.0060.02012.59
5.4.250.0040.02312.59
5.4.240.0040.02412.59
5.4.230.0070.02212.59
5.4.220.0050.01912.59
5.4.210.0050.02112.58
5.4.200.0090.02012.59
5.4.190.0050.02112.58
5.4.180.0060.02112.58
5.4.170.0060.02412.59
5.4.160.0050.02212.58
5.4.150.0070.02512.58
5.4.140.0080.02012.43
5.4.130.0070.02012.42
5.4.120.0040.02312.40
5.4.110.0040.02012.40
5.4.100.0040.02412.39
5.4.90.0070.02412.40
5.4.80.0060.02012.40
5.4.70.0020.02412.39
5.4.60.0020.02512.39
5.4.50.0080.02212.39
5.4.40.0020.02312.38
5.4.30.0060.02312.38
5.4.20.0050.02312.39
5.4.10.0040.02712.39
5.4.00.0020.02612.13
5.3.290.0090.01912.78
5.3.280.0060.02112.74
5.3.270.0050.02712.74
5.3.260.0050.03212.74
5.3.250.0040.02612.74
5.3.240.0070.02912.74
5.3.230.0050.02912.74
5.3.220.0070.02212.72
5.3.210.0080.03012.72
5.3.200.0070.02212.72
5.3.190.0070.02112.72
5.3.180.0060.02012.72
5.3.170.0070.01912.72
5.3.160.0030.02412.72
5.3.150.0080.02212.72
5.3.140.0050.02212.71
5.3.130.0040.02412.71
5.3.120.0060.02912.71
5.3.110.0050.03112.71
5.3.100.0080.03112.46
5.3.90.0070.02912.45
5.3.80.0080.02612.45
5.3.70.0070.03012.45
5.3.60.0060.03212.44
5.3.50.0070.03012.41
5.3.40.0050.02212.41
5.3.30.0040.02912.39
5.3.20.0070.03112.28
5.3.10.0060.02912.26
5.3.00.0090.02512.26
5.2.170.0020.0479.45
5.2.160.0060.0489.45
5.2.150.0100.0339.45
5.2.140.0060.0349.44
5.2.130.0070.0449.41
5.2.120.0050.0489.41
5.2.110.0110.0259.41
5.2.100.0050.0349.40
5.2.90.0050.0299.40
5.2.80.0040.0309.40
5.2.70.0050.0349.40
5.2.60.0100.0469.36
5.2.50.0080.0479.33
5.2.40.0090.0379.30
5.2.30.0040.0459.27
5.2.20.0090.0359.26
5.2.10.0080.0289.20
5.2.00.0050.0389.07
5.1.60.0080.0278.35
5.1.50.0050.0348.35
5.1.40.0050.0358.33
5.1.30.0070.0308.68
5.1.20.0070.0258.71
5.1.10.0060.0358.43
5.1.00.0090.0308.43
5.0.50.0040.0236.91
5.0.40.0030.0236.77
5.0.30.0040.0336.59
5.0.20.0060.0226.55
5.0.10.0050.0186.53
5.0.00.0030.0316.52
4.4.90.0040.0144.77
4.4.80.0050.0134.75
4.4.70.0030.0174.75
4.4.60.0050.0184.75
4.4.50.0030.0154.77
4.4.40.0020.0264.71
4.4.30.0020.0164.76
4.4.20.0040.0144.84
4.4.10.0030.0154.85
4.4.00.0050.0234.76
4.3.110.0010.0174.67
4.3.100.0040.0154.66
4.3.90.0020.0164.64
4.3.80.0030.0264.59
4.3.70.0040.0144.63
4.3.60.0020.0164.63
4.3.50.0050.0154.62
4.3.40.0040.0244.54
4.3.30.0020.0163.30
4.3.20.0000.0183.27
4.3.10.0000.0173.22
4.3.00.0170.0177.45

preferences:
66.52 ms | 401 KiB | 5 Q