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 foreach ($xml->item as $item) { if ($item->images->image->count() > 1) { // Clone entry $images = clone $item->images; // Remove entry and replace with empty unset($item->images); $item->addChild('images'); var_dump($images->image); foreach ($images->image as $key => $img ) { var_dump($key); $name = 'image' . ($key) ?: ''; $item->images->addChild($name, $img); } } } //$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.0160.00318.64
8.3.50.0130.00821.33
8.3.40.0040.01118.92
8.3.30.0090.00920.54
8.3.20.0080.00020.55
8.3.10.0000.00722.34
8.3.00.0030.00522.64
8.2.180.0090.00918.54
8.2.170.0090.00922.96
8.2.160.0110.00420.60
8.2.150.0150.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0030.00519.79
8.2.110.0090.00022.33
8.2.100.0090.00319.41
8.2.90.0040.00419.45
8.2.80.0090.00019.53
8.2.70.0030.00617.87
8.2.60.0040.00418.18
8.2.50.0030.00618.07
8.2.40.0000.00718.41
8.2.30.0000.00818.29
8.2.20.0040.00417.92
8.2.10.0000.00817.86
8.2.00.0040.00417.82
8.1.280.0150.00625.92
8.1.270.0000.00824.66
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0090.00024.08
8.1.230.0090.00319.47
8.1.220.0000.00817.91
8.1.210.0040.00418.77
8.1.200.0040.00417.47
8.1.190.0080.00017.55
8.1.180.0060.00319.26
8.1.170.0090.00018.54
8.1.160.0040.00422.27
8.1.150.0000.00718.77
8.1.140.0040.00417.71
8.1.130.0030.00618.09
8.1.120.0000.00817.68
8.1.110.0050.00217.54
8.1.100.0040.00417.64
8.1.90.0030.00317.60
8.1.80.0040.00417.59
8.1.70.0070.00017.61
8.1.60.0000.00817.79
8.1.50.0000.00817.80
8.1.40.0000.00717.64
8.1.30.0030.00617.91
8.1.20.0040.00417.77
8.1.10.0040.00417.82
8.1.00.0030.00717.72
8.0.300.0040.00418.77
8.0.290.0070.00017.43
8.0.280.0080.00018.68
8.0.270.0030.00317.50
8.0.260.0030.00517.04
8.0.250.0030.00317.24
8.0.240.0000.00817.18
8.0.230.0000.00717.25
8.0.220.0000.00717.01
8.0.210.0030.00317.16
8.0.200.0000.00717.20
8.0.190.0000.00817.21
8.0.180.0000.00717.18
8.0.170.0040.00417.21
8.0.160.0070.00017.02
8.0.150.0040.00417.06
8.0.140.0030.00717.12
8.0.130.0000.00613.60
8.0.120.0030.00517.14
8.0.110.0030.00317.00
8.0.100.0020.00517.02
8.0.90.0040.00416.88
8.0.80.0100.00617.18
8.0.70.0020.00517.03
8.0.60.0040.00417.03
8.0.50.0040.00416.87
8.0.30.0110.00817.39
8.0.20.0110.00817.48
8.0.10.0050.00317.32
8.0.00.0100.01216.91
7.4.330.0000.00515.00
7.4.320.0060.00016.76
7.4.300.0060.00016.73
7.4.290.0000.00716.80
7.4.280.0040.00416.88
7.4.270.0030.00316.88
7.4.260.0030.00416.78
7.4.250.0070.00016.76
7.4.240.0020.00516.79
7.4.230.0070.00016.75
7.4.220.0150.00016.78
7.4.210.0070.00716.73
7.4.200.0030.00516.72
7.4.190.0030.00316.95
7.4.160.0070.01016.70
7.4.150.0070.01017.40
7.4.140.0160.00517.86
7.4.130.0080.01016.82
7.4.120.0090.01416.71
7.4.110.0070.01016.53
7.4.100.0090.00916.68
7.4.90.0070.01016.79
7.4.80.0160.00919.39
7.4.70.0060.00916.72
7.4.60.0060.01716.63
7.4.50.0040.00416.66
7.4.40.0000.01022.77
7.4.30.0070.01016.75
7.4.00.0050.00914.99
7.3.330.0030.00313.39
7.3.320.0050.00013.41
7.3.310.0030.00316.58
7.3.300.0000.00716.59
7.3.290.0100.00316.53
7.3.280.0050.00916.51
7.3.270.0120.00917.40
7.3.260.0210.00016.67
7.3.250.0120.00516.61
7.3.240.0150.00316.78
7.3.230.0070.01716.50
7.3.210.0120.00616.44
7.3.200.0060.01219.39
7.3.190.0120.00616.48
7.3.180.0060.00916.69
7.3.170.0140.00316.51
7.3.160.0090.01616.81
7.3.120.0070.01214.91
7.3.110.0100.01014.81
7.3.100.0030.00914.88
7.3.90.0070.01014.70
7.3.80.0060.00914.90
7.3.70.0090.00314.68
7.3.60.0060.00314.75
7.3.50.0000.01114.91
7.3.40.0000.01414.67
7.3.30.0030.01514.90
7.3.20.0030.00916.84
7.3.10.0050.00916.67
7.3.00.0080.00516.67
7.2.330.0120.00616.99
7.2.320.0140.00417.00
7.2.310.0100.01317.05
7.2.300.0070.01017.07
7.2.290.0080.00816.86
7.2.250.0060.01314.98
7.2.240.0110.00814.97
7.2.230.0060.01215.09
7.2.220.0070.00715.32
7.2.210.0060.00315.29
7.2.200.0030.01015.32
7.2.190.0040.01415.16
7.2.180.0150.00014.95
7.2.170.0000.01515.19
7.2.130.0070.00616.97
7.2.120.0070.00516.85
7.2.110.0050.00816.93
7.2.100.0070.00516.98
7.2.90.0050.00816.98
7.2.80.0050.00817.04
7.2.70.0060.00717.06
7.2.60.0050.00716.99
7.2.50.0080.00517.06
7.2.40.0050.00717.04
7.2.30.0070.00417.06
7.2.20.0070.00717.00
7.2.10.0060.00816.96
7.2.00.0060.00817.44
7.1.330.0070.00715.95
7.1.320.0070.00416.06
7.1.310.0000.01315.71
7.1.300.0060.00616.06
7.1.290.0130.00315.79
7.1.280.0060.00915.95
7.1.270.0090.00615.86
7.1.260.0060.00616.10
7.1.250.0050.00615.86
7.1.240.0080.00515.70
7.1.230.0070.00715.93
7.1.220.0060.00915.81
7.1.210.0030.00915.74
7.1.200.0040.00715.75
7.1.190.0040.00715.96
7.1.180.0080.00315.80
7.1.170.0120.00415.74
7.1.160.0090.00615.85
7.1.150.0030.01315.73
7.1.140.0080.00315.84
7.1.130.0110.00315.82
7.1.120.0050.00815.78
7.1.110.0070.00615.94
7.1.100.0040.01116.78
7.1.90.0060.00715.73
7.1.80.0060.00715.92
7.1.70.0030.00516.29
7.1.60.0040.01316.98
7.1.50.0080.00616.24
7.1.40.0060.00815.81
7.1.30.0080.00815.92
7.1.20.0070.00515.88
7.1.10.0050.00815.78
7.1.00.0100.01218.07
7.0.330.0070.01015.37
7.0.320.0060.00615.39
7.0.310.0070.00715.34
7.0.300.0040.00715.29
7.0.290.0080.00715.31
7.0.280.0060.00615.37
7.0.270.0080.00515.39
7.0.260.0070.00715.36
7.0.250.0050.01015.34
7.0.240.0060.01015.48
7.0.230.0020.01215.51
7.0.220.0030.00815.51
7.0.210.0030.00815.45
7.0.200.0010.01115.83
7.0.190.0020.01115.45
7.0.180.0090.00415.27
7.0.170.0050.00715.46
7.0.160.0080.00515.36
7.0.150.0050.00915.52
7.0.140.0050.03117.56
7.0.130.0090.00515.47
7.0.120.0060.00915.47
7.0.110.0030.01315.51
7.0.100.0050.00915.54
7.0.90.0080.00515.58
7.0.80.0080.00915.41
7.0.70.0150.00515.45
7.0.60.0070.03016.98
7.0.50.0110.02816.25
7.0.40.0060.03015.70
7.0.30.0120.02215.87
7.0.20.0120.02115.70
7.0.10.0040.03415.68
7.0.00.0040.02215.85
5.6.380.0030.00714.37
5.6.370.0070.00514.36
5.6.360.0070.00814.25
5.6.350.0070.00414.54
5.6.340.0090.00614.50
5.6.330.0050.01114.24
5.6.320.0090.00614.46
5.6.310.0140.00214.53
5.6.300.0090.00414.53
5.6.290.0080.00714.38
5.6.280.0040.03316.57
5.6.270.0040.00914.45
5.6.260.0040.00914.32
5.6.250.0050.01114.33
5.6.240.0140.00714.20
5.6.230.0070.00914.41
5.6.220.0070.01214.45
5.6.210.0060.03716.66
5.6.200.0040.01915.63
5.6.190.0060.03416.48
5.6.180.0040.03216.33
5.6.170.0100.02216.56
5.6.160.0040.03016.40
5.6.150.0060.02915.64
5.6.140.0090.02315.74
5.6.130.0080.01815.68
5.6.120.0040.03516.56
5.6.110.0050.02616.54
5.6.100.0060.03116.57
5.6.90.0060.03216.69
5.6.80.0090.02416.25
5.6.70.0070.00414.28
5.6.60.0050.00514.25
5.6.50.0080.00714.15
5.6.40.0050.00814.27
5.6.30.0030.00814.21
5.6.20.0050.00814.20
5.6.10.0090.00714.14
5.6.00.0060.01014.33
5.5.380.0030.00611.25
5.5.370.0050.00611.19
5.5.360.0050.00711.18
5.5.350.0070.02914.34
5.5.340.0010.03313.48
5.5.330.0070.02414.38
5.5.320.0130.03314.30
5.5.310.0090.03214.27
5.5.300.0040.03013.37
5.5.290.0050.03113.61
5.5.280.0060.02414.42
5.5.270.0080.02514.37
5.5.260.0100.02814.42
5.5.250.0050.03214.36
5.5.240.0040.02014.22
5.5.230.0060.00611.24
5.5.220.0040.00711.14
5.5.210.0070.00511.02
5.5.200.0050.00511.06
5.5.190.0040.00511.15
5.5.180.0050.00411.11
5.5.170.0030.00611.05
5.5.160.0050.00311.03
5.5.150.0020.01111.11
5.5.140.0060.00310.99
5.5.130.0040.00511.20
5.5.120.0050.00311.11
5.5.110.0020.00611.12
5.5.100.0060.00311.17
5.5.90.0020.00811.25
5.5.80.0050.00611.10
5.5.70.0000.00911.24
5.5.60.0050.00311.09
5.5.50.0050.00711.04
5.5.40.0020.00611.11
5.5.30.0070.00311.15
5.5.20.0020.00811.11
5.5.10.0020.00911.15
5.5.00.0050.00511.09
5.4.450.0310.01513.95
5.4.440.0300.01613.95
5.4.430.0170.01613.99
5.4.420.0030.03113.93
5.4.410.0060.02113.97
5.4.400.0070.02113.84
5.4.390.0090.01813.71
5.4.380.0060.02213.83
5.4.370.0050.02013.70
5.4.360.0040.02313.77
5.4.350.0050.01611.43
5.4.340.0080.01511.43
5.4.330.0030.00611.03
5.4.320.0020.01811.63
5.4.310.0040.02111.59
5.4.300.0050.01611.69
5.4.290.0040.01811.52
5.4.280.0030.01711.62
5.4.270.0020.01811.52
5.4.260.0020.01911.58
5.4.250.0040.02313.76
5.4.240.0070.02013.68
5.4.230.0040.02113.76
5.4.220.0060.02713.65
5.4.210.0040.02313.61
5.4.200.0070.01913.72
5.4.190.0080.01713.84
5.4.180.0060.02013.71
5.4.170.0030.02413.68
5.4.160.0030.02313.62
5.4.150.0090.02013.66
5.4.140.0060.02712.92
5.4.130.0060.01912.92
5.4.120.0090.01812.86
5.4.110.0060.02012.77
5.4.100.0040.01912.84
5.4.90.0060.01912.93
5.4.80.0060.02012.86
5.4.70.0060.01712.96
5.4.60.0070.01912.79
5.4.50.0040.02412.80
5.4.40.0000.02512.78
5.4.30.0050.02312.92
5.4.20.0030.02112.83
5.4.10.0080.01912.90
5.4.00.0110.02212.63
5.3.290.0060.01611.58
5.3.280.0030.02212.13
5.3.270.0050.02012.12
5.3.260.0080.01912.17
5.3.250.0070.01812.19
5.3.240.0080.01512.08
5.3.230.0060.02012.14
5.3.220.0060.02012.08
5.3.210.0040.02112.06
5.3.200.0040.02212.04
5.3.190.0040.02112.02
5.3.180.0060.02112.11
5.3.170.0060.02012.10
5.3.160.0030.02012.15
5.3.150.0050.02012.16
5.3.140.0060.02012.13
5.3.130.0080.01812.10
5.3.120.0080.01912.11
5.3.110.0030.03012.12
5.3.100.0060.02611.97
5.3.90.0070.02711.92
5.3.80.0070.02211.84
5.3.70.0080.01911.86
5.3.60.0030.02611.93
5.3.50.0030.02411.88
5.3.40.0020.02311.88
5.3.30.0090.02011.83
5.3.20.0090.01511.83
5.3.10.0080.01711.69
5.3.00.0020.02211.78
5.2.170.0040.01810.86
5.2.160.0050.01710.89
5.2.150.0040.02510.89
5.2.140.0040.02010.80
5.2.130.0060.02010.79
5.2.120.0070.02010.82
5.2.110.0040.01810.81
5.2.100.0020.02410.82
5.2.90.0010.01910.81
5.2.80.0060.02010.84
5.2.70.0040.01710.88
5.2.60.0040.01910.79
5.2.50.0080.01610.79
5.2.40.0070.01410.78
5.2.30.0070.01410.81
5.2.20.0030.01810.81
5.2.10.0040.01610.81
5.2.00.0050.01810.74
5.1.60.0040.01510.50
5.1.50.0040.01810.53
5.1.40.0050.01510.48
5.1.30.0050.01210.61
5.1.20.0070.01610.52
5.1.10.0040.01610.58
5.1.00.0040.01710.47
5.0.50.0060.0109.98
5.0.40.0050.0149.96
5.0.30.0060.0169.92
5.0.20.0050.0119.89
5.0.10.0040.0119.84
5.0.00.0030.0229.90
4.4.90.0020.0109.60
4.4.80.0050.0099.60
4.4.70.0020.0129.60
4.4.60.0010.0119.60
4.4.50.0010.0129.60
4.4.40.0040.0169.60
4.4.30.0040.0089.60
4.4.20.0030.0099.60
4.4.10.0050.0109.60
4.4.00.0040.0179.60
4.3.110.0010.0179.60
4.3.100.0020.0109.60
4.3.90.0020.0099.60
4.3.80.0020.0159.60
4.3.70.0020.0129.60
4.3.60.0030.0089.60
4.3.50.0040.0089.60
4.3.40.0010.0159.60
4.3.30.0040.0099.60
4.3.20.0040.0089.60
4.3.10.0040.0119.60
4.3.00.0030.00811.97

preferences:
40.97 ms | 401 KiB | 5 Q