3v4l.org

run code in 500+ PHP versions simultaneously
<?php $xml = '<products> <group> <product id="853" symbol="XYZ123" stock="73"></product> <product id="941" symbol="ERX412" stock="57"></product> <product id="1960" symbol="UIX981" stock="21"></product> </group> </products>'; $ids = [853, 1960]; $array = json_decode(json_encode((array)simplexml_load_string($xml)),true); foreach($array['group']['product'] as $v){ $cur = $v['@attributes']['id']; $stock = $v['@attributes']['stock']; in_array($cur, $ids) ? ($res[$cur] = $stock) : ''; } print_r($res);

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.70.0090.00817.14
8.5.60.0110.00717.02
8.5.50.0040.00316.82
8.5.30.0130.00819.46
8.5.20.0100.00721.46
8.5.10.0100.01016.92
8.5.00.0120.00920.17
8.4.220.0150.00719.68
8.4.210.0050.00521.66
8.4.180.0140.00820.71
8.4.170.0100.01324.17
8.4.160.0130.00923.31
8.4.150.0080.00516.98
8.4.140.0060.01617.56
8.4.130.0100.01018.03
8.4.120.0120.00820.69
8.4.110.0080.00122.69
8.4.100.0130.00817.79
8.4.90.0130.00622.68
8.4.80.0110.00819.67
8.4.70.0050.00318.42
8.4.60.0080.00918.83
8.4.50.0110.01020.77
8.4.40.0040.00419.57
8.4.30.0100.01020.48
8.4.20.0130.00618.97
8.4.10.0100.01017.76
8.3.310.0080.01218.81
8.3.300.0110.01119.24
8.3.290.0110.01021.06
8.3.280.0110.00818.60
8.3.270.0170.00316.67
8.3.260.0040.00516.82
8.3.250.0050.01419.21
8.3.240.0100.01016.90
8.3.230.0040.00616.89
8.3.220.0050.00419.32
8.3.210.0090.00916.75
8.3.200.0030.00616.73
8.3.190.0110.00417.08
8.3.180.0100.00816.65
8.3.170.0150.00317.27
8.3.160.0070.01420.90
8.3.150.0070.00719.05
8.3.140.0070.01117.25
8.3.130.0080.00018.59
8.3.120.0060.00319.05
8.3.110.0000.00920.94
8.3.100.0040.00424.06
8.3.90.0060.00326.77
8.3.80.0050.00516.62
8.3.70.0070.00716.61
8.3.60.0150.00618.68
8.3.50.0110.00418.16
8.3.40.0000.01618.92
8.3.30.0070.00718.89
8.3.20.0080.00020.94
8.3.10.0080.00022.36
8.3.00.0040.00422.55
8.2.310.0100.00718.29
8.2.300.0130.00820.66
8.2.290.0160.00320.68
8.2.280.0090.00918.77
8.2.270.0120.00617.76
8.2.260.0060.00616.75
8.2.250.0040.00418.89
8.2.240.0080.00019.09
8.2.230.0040.00422.58
8.2.220.0080.00037.54
8.2.210.0080.00026.77
8.2.200.0090.00316.75
8.2.190.0150.00317.00
8.2.180.0070.01518.92
8.2.170.0130.00722.96
8.2.160.0140.00020.69
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0110.00426.16
8.2.120.0040.00419.49
8.2.110.0090.00019.39
8.2.100.0030.00918.03
8.2.90.0080.00018.16
8.2.80.0090.00019.17
8.2.70.0030.00517.93
8.2.60.0050.00318.34
8.2.50.0040.00418.10
8.2.40.0030.00619.59
8.2.30.0060.00319.54
8.2.20.0000.00818.40
8.2.10.0030.00319.48
8.2.00.0000.00719.60
8.1.340.0130.01017.94
8.1.330.0100.00824.13
8.1.320.0130.00716.34
8.1.310.0040.00418.46
8.1.300.0090.00019.59
8.1.290.0060.00318.88
8.1.280.0030.01725.92
8.1.270.0040.00422.79
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00321.19
8.1.230.0040.00821.16
8.1.220.0000.00918.04
8.1.210.0040.00418.77
8.1.200.0070.00317.61
8.1.190.0030.00617.48
8.1.180.0060.00318.10
8.1.170.0060.00318.84
8.1.160.0040.00419.14
8.1.150.0040.00419.00
8.1.140.0000.00820.38
8.1.130.0000.00820.33
8.1.120.0030.00717.74
8.1.110.0000.00717.59
8.1.100.0040.00417.57
8.1.90.0000.00817.71
8.1.80.0080.00017.75
8.1.70.0070.00017.56
8.1.60.0000.00817.76
8.1.50.0080.00017.77
8.1.40.0040.00417.68
8.1.30.0030.00517.75
8.1.20.0000.00817.89
8.1.10.0000.00817.72
8.1.00.0000.00817.79
8.0.300.0040.00418.77
8.0.290.0050.00316.88
8.0.280.0040.00418.63
8.0.270.0000.00717.43
8.0.260.0000.00620.29
8.0.250.0040.00417.21
8.0.240.0070.00017.13
8.0.230.0000.00717.08
8.0.220.0080.00017.15
8.0.210.0030.00317.18
8.0.200.0030.00317.10
8.0.190.0080.00017.02
8.0.180.0050.00317.09
8.0.170.0000.00817.09
8.0.160.0000.00717.03
8.0.150.0000.00816.97
8.0.140.0040.00416.95
8.0.130.0030.00313.57
8.0.120.0030.00517.12
8.0.110.0000.00716.99
8.0.100.0020.00616.91
8.0.90.0060.00316.93
8.0.80.0070.00817.10
8.0.70.0020.00617.02
8.0.60.0020.00617.11
8.0.50.0050.00417.15
8.0.30.0110.00917.21
8.0.20.0080.00617.39
8.0.10.0050.00317.19
8.0.00.0080.00417.19
7.4.330.0020.00216.88
7.4.320.0030.00316.75
7.4.300.0000.00616.84
7.4.290.0000.00616.85
7.4.280.0050.00316.73
7.4.270.0000.00816.72
7.4.260.0000.00613.52
7.4.250.0030.00316.67
7.4.240.0040.00416.75
7.4.230.0020.00616.81
7.4.220.0010.00616.88
7.4.210.0080.00516.84
7.4.200.0050.00216.81
7.4.190.0080.00016.80
7.4.180.0000.00816.64
7.4.160.0120.00916.86
7.4.150.0070.00016.46
7.4.140.0050.00216.70
7.4.130.0030.00916.60
7.4.120.0120.00716.74
7.4.110.0050.00716.72
7.4.100.0050.00916.78
7.4.90.0060.00916.65
7.4.80.0060.00917.48
7.4.70.0120.00316.70
7.4.60.0070.00816.68
7.4.50.0050.00916.51
7.4.40.0080.00716.56
7.4.30.0100.00316.66
7.4.20.0140.00616.74
7.4.10.0130.00916.50
7.4.00.0100.00416.31
7.3.330.0040.00416.49
7.3.320.0030.00313.37
7.3.310.0030.00316.61
7.3.300.0000.00716.41
7.3.290.0040.00416.59
7.3.280.0020.01016.57
7.3.270.0000.00716.55
7.3.260.0140.00816.61
7.3.250.0040.00216.52
7.3.240.0080.00716.65
7.3.230.0050.00716.58
7.3.220.0070.00516.52
7.3.210.0090.00816.62
7.3.200.0070.00716.63
7.3.190.0070.00916.49
7.3.180.0100.00516.61
7.3.170.0100.00516.63
7.3.160.0080.00816.55
7.3.150.0130.00616.49
7.3.140.0170.01016.52
7.3.130.0170.00716.58
7.3.120.0160.00316.45
7.3.110.0110.00916.57
7.3.100.0170.01116.01
7.3.90.0120.00816.03
7.3.80.0120.00615.91
7.3.70.0130.00816.09
7.3.60.0080.00615.98
7.3.50.0070.00615.89
7.3.40.0100.00516.04
7.3.30.0090.00516.04
7.3.20.0040.01116.63
7.3.10.0080.00616.64
7.3.00.0040.01116.58
7.2.340.0070.00616.61
7.2.330.0100.00516.84
7.2.320.0090.00616.68
7.2.310.0050.00916.70
7.2.300.0070.01016.78
7.2.290.0070.00816.84
7.2.280.0150.00516.79
7.2.270.0130.00616.77
7.2.260.0110.00716.60
7.2.250.0120.00716.70
7.2.240.0130.00916.58
7.2.230.0170.00416.14
7.2.220.0130.00816.26
7.2.210.0090.00916.06
7.2.200.0140.00616.29
7.2.190.0110.00415.99
7.2.180.0060.00816.05
7.2.170.0080.00916.31
7.2.160.0070.01016.21
7.2.150.0100.00716.93
7.2.140.0110.00316.87
7.2.130.0110.00516.91
7.2.120.0080.00716.86
7.2.110.0090.00516.96
7.2.100.0070.00916.89
7.2.90.0100.00616.79
7.2.80.0090.00816.89
7.2.70.0090.00716.84
7.2.60.0110.00916.84
7.2.50.0060.00816.84
7.2.40.0080.00616.86
7.2.30.0090.00616.86
7.2.20.0050.01016.79
7.2.10.0090.00516.86
7.2.00.0080.00816.90
7.1.330.0130.00716.74
7.1.320.0110.00715.81
7.1.310.0140.00415.82
7.1.300.0120.00815.75
7.1.290.0140.00615.78
7.1.280.0220.00415.82
7.1.270.0080.01215.74
7.1.260.0160.00515.76
7.1.250.0110.00615.76
7.1.240.0150.00316.53
7.1.230.0200.00516.58
7.1.220.0180.00516.68
7.1.210.0140.00616.70
7.1.200.0130.00716.63
7.1.190.0160.00316.69
7.1.180.0120.01016.54
7.1.170.0180.00216.57
7.1.160.0130.00616.62
7.1.150.0100.00916.64
7.1.140.0100.01016.54
7.1.130.0170.00616.55
7.1.120.0140.00516.56
7.1.110.0160.00316.57
7.1.100.0150.00416.56
7.1.90.0110.00616.55
7.1.80.0170.00416.64
7.1.70.0130.00716.48
7.1.60.0130.00616.65
7.1.50.0120.00916.60
7.1.40.0070.01216.63
7.1.30.0160.00216.46
7.1.20.0150.00616.54
7.1.10.0110.00716.66
7.1.00.0160.00716.64

preferences:
55.3 ms | 1698 KiB | 5 Q