3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<root> <itemList> <item> <name>A</name> <type>AAA</type> </item> <item> <name>B</name> <type>BBB</type> </item> <item> <name>C</name> <type>CCC</type> </item> </itemList> </root>"; $xml = new SimpleXMLElement($xml); $res = $xml->xpath('//type[contains(text(), "BBB")]/parent::item/preceding-sibling::item[1]'); echo "{$res[0]->name} ({$res[0]->type})".PHP_EOL; $res = $xml->xpath('//type[contains(text(), "CCC")]/parent::item/preceding-sibling::item[1]'); echo "{$res[0]->name} ({$res[0]->type})";

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.130.0070.00318.67
8.3.120.0100.01019.09
8.3.110.0090.00018.80
8.3.100.0090.00024.06
8.3.90.0030.00626.77
8.3.80.0070.00316.75
8.3.70.0140.00717.13
8.3.60.0040.01118.68
8.3.50.0090.00818.50
8.3.40.0130.00319.16
8.3.30.0070.00718.77
8.3.20.0080.00022.15
8.3.10.0040.01123.82
8.3.00.0040.00423.91
8.2.250.0070.00717.35
8.2.240.0130.00017.59
8.2.230.0030.00620.94
8.2.220.0060.00337.54
8.2.210.0060.00926.77
8.2.200.0030.00616.88
8.2.190.0180.00416.88
8.2.180.0100.01017.00
8.2.170.0090.00622.96
8.2.160.0100.01020.85
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0040.00421.44
8.2.120.0040.00426.35
8.2.110.0030.00620.71
8.2.100.0090.00318.22
8.2.90.0070.00020.84
8.2.80.0000.00818.18
8.2.70.0080.00018.30
8.2.60.0030.00718.59
8.2.50.0000.00818.10
8.2.40.0070.00021.03
8.2.30.0050.00321.11
8.2.20.0070.00018.32
8.2.10.0040.00418.58
8.2.00.0040.00418.32
8.1.300.0110.00718.60
8.1.290.0060.00330.84
8.1.280.0080.00825.92
8.1.270.0000.00822.61
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00022.38
8.1.230.0120.00024.13
8.1.220.0000.00818.01
8.1.210.0060.00319.35
8.1.200.0100.00017.73
8.1.190.0050.00317.60
8.1.180.0080.00018.10
8.1.170.0040.00419.05
8.1.160.0000.00819.19
8.1.150.0030.00520.50
8.1.140.0020.00517.95
8.1.130.0070.00017.91
8.1.120.0070.00317.84
8.1.110.0040.00417.93
8.1.100.0050.00217.86
8.1.90.0030.00617.93
8.1.80.0040.00417.64
8.1.70.0000.00817.84
8.1.60.0060.00317.76
8.1.50.0090.00017.75
8.1.40.0040.00417.89
8.1.30.0050.00318.04
8.1.20.0030.00618.02
8.1.10.0030.00617.93
8.1.00.0060.00317.88
8.0.300.0000.00720.41
8.0.290.0040.00417.25
8.0.280.0070.00018.71
8.0.270.0000.00817.45
8.0.260.0030.00517.29
8.0.250.0000.00717.32
8.0.240.0030.00617.33
8.0.230.0000.00717.31
8.0.220.0040.00417.13
8.0.210.0000.00717.05
8.0.200.0000.00717.21
8.0.190.0050.00217.11
8.0.180.0070.00017.17
8.0.170.0000.00917.09
8.0.160.0040.00417.12
8.0.150.0040.00417.07
8.0.140.0070.00017.05
8.0.130.0000.00513.69
8.0.120.0080.00215.51
8.0.110.0070.00415.31
8.0.100.0090.00215.51
8.0.90.0060.00515.42
8.0.80.0070.00815.45
8.0.70.0070.00315.53
8.0.60.0080.00315.33
8.0.50.0040.00615.44
8.0.30.0100.00716.07
8.0.20.0150.00516.46
8.0.10.0160.00916.30
8.0.00.0130.00716.65
7.4.330.0050.00015.55
7.4.320.0060.00016.94
7.4.300.0030.00316.82
7.4.290.0040.00416.82
7.4.280.0000.00716.81
7.4.270.0030.00716.89
7.4.260.0040.00416.79
7.4.250.0100.00215.25
7.4.240.0090.00215.23
7.4.230.0090.00315.22
7.4.220.0080.00315.26
7.4.210.0030.01115.84
7.4.200.0050.00515.37
7.4.190.0080.00613.62
7.4.180.0060.00713.50
7.4.160.0110.00616.00
7.4.150.0100.01015.97
7.4.140.0140.00917.01
7.4.130.0150.00716.25
7.4.120.0120.01016.49
7.4.110.0130.00816.20
7.4.100.0140.01116.16
7.4.90.0160.00716.28
7.4.80.0090.01016.82
7.4.70.0130.00716.34
7.4.60.0130.00716.39
7.4.50.0110.00916.36
7.4.40.0110.00916.30
7.4.30.0110.00816.27
7.4.20.0110.00816.26
7.4.10.0110.00816.20
7.4.00.0090.00816.02
7.3.330.0000.00513.52
7.3.320.0060.00313.50
7.3.310.0020.00815.03
7.3.300.0080.00214.88
7.3.290.0030.00714.95
7.3.280.0120.00615.82
7.3.270.0080.01115.83
7.3.260.0180.00616.31
7.3.250.0130.00816.29
7.3.240.0120.01016.33
7.3.230.0150.00616.11
7.3.220.0190.00615.78
7.3.210.0150.00616.18
7.3.200.0120.01016.25
7.3.190.0110.00916.36
7.3.180.0140.00516.26
7.3.170.0130.00816.33
7.3.160.0110.00916.29
7.3.150.0140.00616.19
7.3.140.0120.00616.15
7.3.130.0110.00716.11
7.3.120.0090.00916.07
7.3.110.0090.00715.94
7.3.100.0060.01115.85
7.3.90.0080.00815.92
7.3.80.0080.00815.93
7.3.70.0060.00915.90
7.3.60.0080.00915.91
7.3.50.0060.00915.96
7.3.40.0090.00715.86
7.3.30.0080.01015.88
7.3.20.0070.00916.79
7.3.10.0110.00616.85
7.3.00.0090.00716.84
7.2.340.0160.00815.89
7.2.330.0190.00716.30
7.2.320.0100.01216.28
7.2.310.0140.00816.43
7.2.300.0110.01116.37
7.2.290.0150.00816.36
7.2.280.0160.00716.25
7.2.270.0150.00916.39
7.2.260.0120.01116.07
7.2.250.0100.01116.07
7.2.240.0150.00516.05
7.2.230.0120.00916.05
7.2.220.0120.01016.21
7.2.210.0130.00816.13
7.2.200.0110.01016.21
7.2.190.0130.00816.19
7.2.180.0130.00816.12
7.2.170.0110.00816.11
7.2.160.0150.00816.21
7.2.150.0140.00817.06
7.2.140.0180.00616.98
7.2.130.0130.01017.04
7.2.120.0130.01117.06
7.2.110.0110.01017.18
7.2.100.0200.00617.04
7.2.90.0170.00417.11
7.2.80.0120.00917.04
7.2.70.0150.00817.16
7.2.60.0130.00617.03
7.2.50.0130.00917.04
7.2.40.0140.00817.07
7.2.30.0140.00717.11
7.2.20.0130.00917.17
7.2.10.0120.01017.16
7.2.00.0130.00817.03
7.1.330.0140.00816.14
7.1.320.0180.00816.13
7.1.310.0140.00716.08
7.1.300.0150.00716.20
7.1.290.0140.00916.05
7.1.280.0160.00616.07
7.1.270.0150.00716.13
7.1.260.0160.00716.09
7.1.250.0140.00916.16
7.1.240.0180.00816.14
7.1.230.0190.00716.08
7.1.220.0130.01016.18
7.1.210.0150.00816.14
7.1.200.0150.01016.15
7.1.190.0130.00816.12
7.1.180.0130.00916.17
7.1.170.0120.01116.08
7.1.160.0160.00716.11
7.1.150.0140.00816.23
7.1.140.0130.00916.14
7.1.130.0160.00716.20
7.1.120.0150.00716.21
7.1.110.0120.01016.13
7.1.100.0140.00716.21
7.1.90.0140.00916.17
7.1.80.0100.01116.18
7.1.70.0260.00615.99
7.1.60.0180.00918.29
7.1.50.0180.00918.26
7.1.40.0200.01018.31
7.1.30.0200.01018.20
7.1.20.0180.00918.20
7.1.10.0130.00915.95
7.1.00.0150.00915.93
7.0.330.0150.00815.84
7.0.320.0210.00615.87
7.0.310.0180.00915.82
7.0.300.0150.00715.87
7.0.290.0150.00815.82
7.0.280.0180.00715.88
7.0.270.0170.00815.92
7.0.260.0160.00815.89
7.0.250.0170.00715.93
7.0.240.0170.00615.86
7.0.230.0120.01015.89
7.0.220.0150.00815.91
7.0.210.0170.00615.97
7.0.200.0150.00915.93
7.0.190.0170.00715.94
7.0.180.0180.00615.91
7.0.170.0180.00615.98
7.0.160.0140.00815.90
7.0.150.0180.00615.89
7.0.140.0200.00815.88
7.0.130.0190.00915.93
7.0.120.0170.00815.89
7.0.110.0140.00715.88
7.0.100.0180.00515.88
7.0.90.0130.00815.78
7.0.80.0180.00715.88
7.0.70.0180.00715.78
7.0.60.0120.00815.90
7.0.50.0120.00715.92
7.0.40.0170.00615.32
7.0.30.0140.00915.34
7.0.20.0160.00915.29
7.0.10.0120.00915.36
7.0.00.0180.00515.33
5.6.400.0160.00815.70
5.6.390.0160.00915.72
5.6.380.0150.01015.65
5.6.370.0130.01015.71
5.6.360.0150.00815.71
5.6.350.0140.00915.65
5.6.340.0110.01315.72
5.6.330.0170.00815.67
5.6.320.0150.01115.65
5.6.310.0150.00815.68
5.6.300.0100.01415.65
5.6.290.0120.01115.72
5.6.280.0170.00715.76
5.6.270.0140.00915.71
5.6.260.0150.00815.82
5.6.250.0150.00715.68
5.6.240.0150.00815.66
5.6.230.0160.00815.68
5.6.220.0130.01115.68
5.6.210.0140.00915.66
5.6.200.0120.00915.71
5.6.190.0150.00715.78
5.6.180.0160.00615.82
5.6.170.0120.00915.74
5.6.160.0150.00715.75
5.6.150.0110.01215.73
5.6.140.0140.00915.73
5.6.130.0120.01115.71
5.6.120.0120.01215.65
5.6.110.0110.01215.68
5.6.100.0160.00715.71
5.6.90.0190.01015.69
5.6.80.0160.00715.72
5.6.70.0130.00815.63
5.6.60.0140.01115.64
5.6.50.0140.00815.63
5.6.40.0130.01015.62
5.6.30.0120.01015.68
5.6.20.0130.00815.59
5.6.10.0100.01215.66
5.6.00.0150.00815.64

preferences:
29.25 ms | 403 KiB | 5 Q