3v4l.org

run code in 300+ PHP versions simultaneously
<?php // From: https://www.kerstner.at/en/2011/12/php-array-to-xml-conversion/ function arrayToXml($array, $rootElement = null, $xml = null) { $_xml = $xml; if ($_xml === null) { $_xml = new SimpleXMLElement($rootElement !== null ? $rootElement : '<root/>'); } foreach ($array as $k => $v) { if (is_array($v)) { //nested array arrayToXml($v, $k, $_xml->addChild($k)); } else { $_xml->addChild($k, $v); } } return $_xml; } $requestResult = <<<EOT { "name": "Benjamin Clementine", "mbid_id": "578e5d1c-be21-4158-b147-30aad67f207d", "albums": { "68e65535-f133-408d-93dd-205e9555eaa5": { "albumcover": [ { "id": "172070", "url": "http://assets.fanart.tv/fanart/music/578e5d1c-be21-4158-b147-30aad67f207d/albumcover/at-least-for-now-55b74dfa59411.jpg", "likes": "0" } ] } } } EOT; $decodedResult = json_decode($requestResult, true); $xmlElement = arrayToXml($decodedResult); echo $xmlElement->asXML(); print_r($xmlElement->xpath('//url'));

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.0130.00316.88
8.3.50.0070.00718.30
8.3.40.0120.00319.08
8.3.30.0080.00619.12
8.3.20.0040.00420.68
8.3.10.0080.00023.90
8.3.00.0040.00419.63
8.2.180.0100.01017.13
8.2.170.0160.00322.96
8.2.160.0100.00320.72
8.2.150.0070.00024.18
8.2.140.0000.00724.66
8.2.130.0060.00617.88
8.2.120.0000.00826.35
8.2.110.0070.00319.64
8.2.100.0070.00718.09
8.2.90.0060.00319.46
8.2.80.0050.00317.97
8.2.70.0030.00617.88
8.2.60.0030.00618.18
8.2.50.0030.00518.07
8.2.40.0000.00819.34
8.2.30.0080.00021.14
8.2.20.0040.00418.05
8.2.10.0040.00418.47
8.2.00.0050.00218.58
8.1.280.0080.00825.92
8.1.270.0000.00822.45
8.1.260.0060.00328.09
8.1.250.0030.00528.09
8.1.240.0090.00021.64
8.1.230.0070.00417.82
8.1.220.0000.00918.05
8.1.210.0030.00618.77
8.1.200.0030.00617.50
8.1.190.0040.00417.61
8.1.180.0040.00418.10
8.1.170.0090.00018.81
8.1.160.0070.00022.33
8.1.150.0000.00819.22
8.1.140.0040.00419.95
8.1.130.0020.00518.18
8.1.120.0040.00417.94
8.1.110.0000.00817.81
8.1.100.0040.00417.80
8.1.90.0040.00417.83
8.1.80.0000.00817.70
8.1.70.0070.00017.60
8.1.60.0040.00417.93
8.1.50.0080.00417.74
8.1.40.0030.00517.84
8.1.30.0050.00318.03
8.1.20.0000.00817.88
8.1.10.0000.00817.83
8.1.00.0040.00717.95
8.0.300.0040.00418.77
8.0.290.0040.00417.25
8.0.280.0000.00718.76
8.0.270.0070.00017.73
8.0.260.0000.00717.69
8.0.250.0050.00317.24
8.0.240.0040.00417.45
8.0.230.0000.00717.43
8.0.220.0030.00317.21
8.0.210.0040.00417.39
8.0.200.0000.01017.38
8.0.190.0040.00417.32
8.0.180.0040.00417.36
8.0.170.0000.00817.21
8.0.160.0030.00317.26
8.0.150.0000.00717.36
8.0.140.0040.00417.27
8.0.130.0030.00313.84
8.0.120.0030.00517.17
8.0.110.0040.00417.33
8.0.100.0000.00717.24
8.0.90.0040.00417.35
8.0.80.0140.00317.27
8.0.70.0040.00417.16
8.0.60.0030.00517.29
8.0.50.0060.00317.37
8.0.30.0110.01017.58
8.0.20.0080.01217.43
8.0.10.0050.00217.47
8.0.00.0080.00917.22
7.4.330.0000.00515.43
7.4.320.0030.00316.94
7.4.300.0050.00216.89
7.4.290.0030.00317.03
7.4.280.0000.00816.88
7.4.270.0070.00016.95
7.4.260.0000.00716.91
7.4.250.0000.00816.72
7.4.240.0020.00516.94
7.4.230.0030.00316.79
7.4.220.0060.01216.95
7.4.210.0050.01116.92
7.4.200.0070.00016.84
7.4.160.0090.00616.77
7.4.150.0240.00317.40
7.4.140.0130.01217.86
7.4.130.0120.00517.01
7.4.120.0110.00717.02
7.4.110.0130.00616.95
7.4.100.0050.01917.14
7.4.90.0160.00316.89
7.4.80.0160.00619.39
7.4.70.0080.01216.90
7.4.60.0030.01316.84
7.4.50.0040.00416.78
7.4.40.0090.00916.67
7.4.30.0080.01616.98
7.4.00.0060.01215.25
7.3.330.0000.00813.64
7.3.320.0060.00013.65
7.3.310.0030.00316.88
7.3.300.0030.00316.71
7.3.290.0040.00416.73
7.3.280.0070.00916.79
7.3.270.0090.00917.40
7.3.260.0180.00616.71
7.3.250.0060.01216.79
7.3.240.0140.00616.87
7.3.230.0150.00616.93
7.3.210.0140.00416.82
7.3.200.0120.00616.82
7.3.190.0130.00416.77
7.3.180.0070.01316.86
7.3.170.0090.00916.84
7.3.160.0120.00616.67
7.3.120.0030.01314.96
7.3.110.0100.01014.91
7.3.100.0040.01214.90
7.3.90.0110.00414.95
7.3.80.0080.00415.26
7.3.70.0130.00014.99
7.3.60.0070.00715.01
7.3.50.0060.00614.98
7.3.40.0090.00614.87
7.3.30.0090.00614.96
7.3.20.0040.00816.89
7.3.10.0090.00416.95
7.3.00.0030.01416.90
7.2.330.0070.01017.17
7.2.320.0100.00716.93
7.2.310.0120.00617.17
7.2.300.0140.00416.79
7.2.290.0080.00817.22
7.2.250.0090.00615.15
7.2.240.0060.01515.01
7.2.230.0030.01415.11
7.2.220.0080.00415.36
7.2.210.0000.01315.25
7.2.200.0090.00615.43
7.2.190.0060.00615.12
7.2.180.0080.00815.39
7.2.170.0120.00415.48
7.2.60.0090.00617.10
7.2.00.0100.00619.63
7.1.330.0060.00915.99
7.1.320.0080.00316.04
7.1.310.0030.00816.00
7.1.300.0030.01015.97
7.1.290.0030.01016.22
7.1.280.0100.00715.95
7.1.270.0090.00615.87
7.1.260.0080.00415.89
7.1.200.0030.00915.73
7.1.100.0070.00718.35
7.1.70.0080.00017.30
7.1.60.0030.02119.48
7.1.50.0100.01016.86
7.1.00.0030.07722.65
7.0.200.0210.00014.92
7.0.100.0070.04720.11
7.0.90.0030.05320.08
7.0.80.0070.04720.14
7.0.70.0100.05320.13
7.0.60.0070.06020.13
7.0.50.0130.07720.52
7.0.40.0030.04720.30
7.0.30.0070.06020.36
7.0.20.0170.06320.27
7.0.10.0130.05720.21
7.0.00.0000.05020.25
5.6.280.0030.06721.14
5.6.250.0100.03721.06
5.6.240.0030.04720.89
5.6.230.0130.05720.95
5.6.220.0070.08020.74
5.6.210.0130.07320.68
5.6.200.0030.04321.27
5.6.190.0100.06321.21
5.6.180.0070.04021.14
5.6.170.0070.05321.21
5.6.160.0030.04321.25
5.6.150.0000.04321.18
5.6.140.0030.04321.18
5.6.130.0030.04721.21
5.6.120.0030.04721.30
5.6.110.0030.06721.33
5.6.100.0030.04321.36
5.6.90.0070.04721.29
5.6.80.0070.04020.60
5.6.70.0070.03320.57
5.6.60.0070.03720.50
5.6.50.0100.03720.62
5.6.40.0030.04020.54
5.6.30.0000.04320.71
5.6.20.0100.08020.66
5.6.10.0100.08020.70
5.6.00.0100.06320.55
5.5.380.0070.03720.61
5.5.370.0070.06020.69
5.5.360.0100.03720.63
5.5.350.0030.04320.58
5.5.340.0070.04020.93
5.5.330.0000.04321.03
5.5.320.0030.04021.07
5.5.310.0130.03320.96
5.5.300.0000.04320.93
5.5.290.0070.06320.96
5.5.280.0070.04321.11
5.5.270.0100.03721.12
5.5.260.0070.05721.05
5.5.250.0000.04320.90
5.5.240.0070.05320.51
5.5.230.0000.04720.46
5.5.220.0100.04320.45
5.5.210.0100.03320.38
5.5.200.0030.04320.49
5.5.190.0070.03720.39
5.5.180.0000.08320.45
5.5.160.0100.07020.28
5.5.150.0100.07020.39
5.5.140.0070.07320.32
5.5.130.0070.08320.48
5.5.120.0170.04720.32
5.5.110.0170.07320.27
5.5.100.0070.07720.31
5.5.90.0270.06320.26
5.5.80.0100.08320.18
5.5.70.0030.08320.25
5.5.60.0070.07720.15
5.5.50.0000.08020.36
5.5.40.0100.06720.21
5.5.30.0130.07020.22
5.5.20.0130.05020.16
5.5.10.0100.07720.23
5.5.00.0000.06320.28

preferences:
54.69 ms | 401 KiB | 5 Q