3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$xml = simplexml_load_file('data.xml'); $xml = simplexml_load_string('<items> <item> <images> <image>A</image> <image>B</image> <image>C</image> </images> </item> </items>'); var_dump($xml); // Loop over items in original xml for($i = 0; $i < count($xml->item); $i++) { //$images; if( (count($xml->item[$i]->images->image)) > 1) { $images = $xml->item[$i]->images; // Remove entry unset($xml->item[$i]->images); $xml->item[$i]->addChild('images'); for($y = 0; $y < $images->image->count(); $y++) { if($y == 0) { $xx = $xml->item[$i]->images->addChild('image', $images->image[$y]); }else { $xml->item[$i]->images->addChild('image' . $y, $images->image[$y]); } } var_dump($images); } } //$xml->asXML('POTO.xml'); echo $xml->asXML();

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.0100.01018.65
8.3.50.0140.00521.33
8.3.40.0140.00418.96
8.3.30.0140.00320.42
8.3.20.0080.00020.52
8.3.10.0080.00022.21
8.3.00.0050.00322.68
8.2.180.0130.00318.43
8.2.170.0100.01022.96
8.2.160.0000.01520.49
8.2.150.0000.00824.18
8.2.140.0030.00624.66
8.2.130.0130.00326.16
8.2.120.0030.00619.79
8.2.110.0190.00319.64
8.2.100.0060.00618.28
8.2.90.0000.00819.66
8.2.80.0050.00317.88
8.2.70.0070.00317.88
8.2.60.0000.00818.29
8.2.50.0000.00818.07
8.2.40.0000.00921.32
8.2.30.0040.00418.34
8.2.20.0060.00317.98
8.2.10.0040.00417.95
8.2.00.0040.00418.11
8.1.280.0040.01825.92
8.1.270.0040.00424.66
8.1.260.0080.00026.35
8.1.250.0000.00928.09
8.1.240.0040.00422.32
8.1.230.0090.00321.09
8.1.220.0080.00018.01
8.1.210.0060.00319.21
8.1.200.0030.00617.48
8.1.190.0030.00517.36
8.1.180.0090.00318.10
8.1.170.0000.00918.79
8.1.160.0100.00019.22
8.1.150.0060.00318.90
8.1.140.0050.00317.78
8.1.130.0000.01018.13
8.1.120.0040.00417.72
8.1.110.0070.00017.76
8.1.100.0000.00717.67
8.1.90.0040.00417.66
8.1.80.0050.00217.73
8.1.70.0000.00717.64
8.1.60.0040.00417.90
8.1.50.0040.00417.72
8.1.40.0040.00417.77
8.1.30.0040.00417.88
8.1.20.0040.00417.84
8.1.10.0060.00317.89
8.1.00.0060.00317.81
8.0.300.0000.00820.46
8.0.290.0050.00316.88
8.0.280.0070.00018.61
8.0.270.0030.00618.35
8.0.260.0000.00818.77
8.0.250.0000.00717.18
8.0.240.0050.00317.13
8.0.230.0030.00317.12
8.0.220.0020.00517.17
8.0.210.0030.00317.07
8.0.200.0000.00717.13
8.0.190.0040.00417.23
8.0.180.0000.00717.17
8.0.170.0000.00917.04
8.0.160.0040.00417.19
8.0.150.0040.00817.00
8.0.140.0000.00717.04
8.0.130.0030.00313.59
8.0.120.0030.00617.18
8.0.110.0000.00817.15
8.0.100.0040.00417.19
8.0.90.0000.00816.99
8.0.80.0110.01117.19
8.0.70.0060.00317.20
8.0.60.0030.00517.13
8.0.50.0040.00417.05
8.0.30.0140.00517.32
8.0.20.0110.00717.40
8.0.10.0030.00617.13
8.0.00.0160.00616.95
7.4.330.0030.00315.00
7.4.320.0060.00016.88
7.4.300.0000.00616.83
7.4.290.0030.00316.88
7.4.280.0000.00816.70
7.4.270.0030.00316.78
7.4.260.0020.00516.86
7.4.250.0040.00416.75
7.4.240.0030.00516.90
7.4.230.0070.00016.75
7.4.220.0130.00316.75
7.4.210.0080.00816.88
7.4.200.0040.00416.95
7.4.190.0030.00317.01
7.4.160.0100.00716.64
7.4.150.0030.01717.40
7.4.140.0110.01017.86
7.4.130.0050.01316.77
7.4.120.0110.00616.86
7.4.110.0060.01116.82
7.4.100.0090.01616.66
7.4.90.0180.00416.93
7.4.80.0120.00919.39
7.4.70.0040.01216.69
7.4.60.0070.01316.67
7.4.50.0060.00316.59
7.4.40.0070.01022.77
7.4.30.0080.00816.92
7.4.00.0040.00815.04
7.3.330.0050.00013.50
7.3.320.0000.00513.43
7.3.310.0000.00716.64
7.3.300.0000.00716.51
7.3.290.0070.00716.65
7.3.280.0090.00816.61
7.3.270.0120.00617.40
7.3.260.0070.01316.79
7.3.250.0090.00816.79
7.3.240.0120.00616.78
7.3.230.0070.01116.89
7.3.210.0030.01316.86
7.3.200.0000.01819.39
7.3.190.0090.01216.68
7.3.180.0070.00716.83
7.3.170.0110.01016.83
7.3.160.0120.00616.66
7.3.120.0070.00715.08
7.3.10.0100.00616.63
7.3.00.0030.01316.82
7.2.330.0100.00716.87
7.2.320.0140.01016.79
7.2.310.0070.01717.06
7.2.300.0120.00917.03
7.2.290.0060.01116.92
7.2.130.0030.01016.90
7.2.120.0040.01217.24
7.2.110.0060.01016.90
7.2.100.0050.00516.98
7.2.90.0060.00916.85
7.2.80.0090.00617.08
7.2.70.0000.01117.11
7.2.60.0130.00316.92
7.2.50.0000.01416.84
7.2.40.0060.00316.90
7.2.30.0060.00916.90
7.2.20.0070.01117.03
7.2.10.0080.00417.08
7.2.00.0090.00518.18
7.1.250.0070.00715.94
7.1.200.0070.00415.86
7.1.100.0030.00918.21
7.1.70.0060.00317.36
7.1.60.0100.01019.43
7.1.50.0100.01017.01
7.1.00.0070.04022.55
7.0.200.0000.01016.66
7.0.140.0030.07722.21
7.0.60.0370.07019.97
7.0.50.0030.04017.90
7.0.40.0100.07020.41
7.0.30.0400.06320.25
7.0.20.0170.05020.27
7.0.10.0130.07720.18
7.0.00.0070.08020.11
5.6.280.0030.07321.06
5.6.210.0170.04020.69
5.6.200.0030.06018.20
5.6.190.0100.05320.51
5.6.180.0530.06720.49
5.6.170.0170.04320.70
5.6.160.0130.07720.69
5.6.150.0100.07018.29
5.6.140.0070.05318.21
5.6.130.0030.08018.26
5.6.120.0130.05021.21
5.6.110.0000.04321.23
5.6.100.0030.07021.13
5.6.90.0100.05721.20
5.6.80.0000.06020.43
5.5.350.0200.08020.63
5.5.340.0130.07318.03
5.5.330.0000.08020.39
5.5.320.0300.07720.32
5.5.310.0170.04320.39
5.5.300.0030.04318.11
5.5.290.0000.05318.12
5.5.280.0070.07721.02
5.5.270.0000.04721.02
5.5.260.0000.04320.94
5.5.250.0100.09320.76
5.5.240.0170.07720.45
5.4.450.3830.04019.67
5.4.440.3130.03019.57
5.4.430.3800.04319.66
5.4.420.4070.03719.66
5.4.410.3170.03019.45
5.4.400.3900.03319.34
5.4.390.3000.03319.12
5.4.380.4130.03019.30
5.4.370.3730.04019.21
5.4.360.3900.04019.21
5.4.350.4300.04019.24
5.4.340.4130.03719.28
5.4.320.4230.03318.95
5.4.310.3930.03719.24
5.4.300.4000.03019.20
5.4.290.3700.04019.33
5.4.280.3630.04019.20
5.4.270.3930.04319.27
5.4.260.3900.04018.95
5.4.250.3870.05319.11
5.4.240.3530.05719.19
5.4.230.3870.03719.23
5.4.220.4030.04019.26
5.4.210.3630.04019.11
5.4.200.3900.04019.24
5.4.190.3830.04018.97
5.4.180.3730.03319.20
5.4.170.3970.03719.23
5.4.160.3770.03719.32
5.4.150.4030.03319.28
5.4.140.3630.03716.46
5.4.130.3800.03016.48
5.4.120.4770.03016.57
5.4.110.3970.03016.59
5.4.100.3630.03716.57
5.4.90.4030.03316.48
5.4.80.4330.03016.60
5.4.70.3700.03716.56
5.4.60.3670.03716.54
5.4.50.3900.03316.38
5.4.40.3900.03716.52
5.4.30.3730.03316.60
5.4.20.3800.03316.60
5.4.10.4600.03716.60
5.4.00.4500.03715.95
5.3.290.4000.03714.80
5.3.280.4030.03314.56
5.3.270.3630.03714.70
5.3.260.3900.03314.71
5.3.250.4170.03014.63
5.3.240.3970.03314.71
5.3.230.3770.03014.74
5.3.220.3800.04014.72
5.3.210.3700.04014.67
5.3.200.4330.03314.64
5.3.190.3730.04314.58
5.3.180.4300.03714.57
5.3.170.3930.03714.66
5.3.160.3630.03714.57
5.3.150.3670.03014.66
5.3.140.4130.03314.52
5.3.130.3830.04314.65
5.3.120.3730.03714.70
5.3.110.3800.03314.64
5.3.100.4070.03014.09
5.3.90.3630.04314.12
5.3.80.4670.03713.93
5.3.70.4300.04014.11
5.3.60.4630.04014.13
5.3.50.4630.04013.96
5.3.40.4630.03714.05
5.3.30.1300.03313.84
5.3.20.0100.02713.78
5.3.10.0530.04013.76
5.3.00.3170.03013.79
5.2.170.3900.03011.09
5.2.160.4330.02711.23
5.2.150.3200.02711.11
5.2.140.0200.02311.38
5.2.130.0070.02711.04
5.2.120.0000.03011.24
5.2.110.1500.03311.14
5.2.100.2600.03011.23
5.2.90.3230.02711.24
5.2.80.3330.02711.06
5.2.70.3170.02711.15
5.2.60.2970.03311.03
5.2.50.2730.03011.06
5.2.40.1730.02311.08
5.2.30.2000.02311.02
5.2.20.1830.02710.94
5.2.10.2200.02310.84
5.2.00.2170.02710.80
5.1.60.2330.02310.16
5.1.50.2300.02010.05
5.1.40.2600.02710.07
5.1.30.2030.03010.47
5.1.20.2500.02310.53
5.1.10.2500.02010.21
5.1.00.2430.03010.20
5.0.50.1330.0178.64
5.0.40.0100.0238.55
5.0.30.0170.0308.34
5.0.20.0030.0338.31
5.0.10.0030.0338.30
5.0.00.0000.0638.34
4.4.90.1300.0136.30
4.4.80.1130.0136.30
4.4.70.1130.0136.30
4.4.60.1270.0136.30
4.4.50.1200.0176.30
4.4.40.0930.0236.30
4.4.30.1330.0136.30
4.4.20.1230.0236.30
4.4.10.1370.0076.30
4.4.00.1430.0306.30
4.3.110.0000.0236.30
4.3.100.0000.0306.30
4.3.90.0100.0276.30
4.3.80.0030.0506.30
4.3.70.0000.0176.30
4.3.60.0030.0176.30
4.3.50.0770.0206.30
4.3.40.1430.0276.30
4.3.30.0770.0236.30
4.3.20.0770.0206.30
4.3.10.0730.0136.30
4.3.00.0730.0176.30

preferences:
47.11 ms | 401 KiB | 5 Q