3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_to_xml($data, &$xml_data) { foreach ($data as $key => $value) { if (is_array($value)) { if (is_numeric($key)){ $key = 'item'.$key; //dealing with <0/>..<n/> issues } $subnode = $xml_data->addChild($key); array_to_xml($value, $subnode); } else { $xml_data->addChild("$key",htmlspecialchars("$value")); } } } $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 = new SimpleXMLElement('<?xml version="1.0"?><root/>'); array_to_xml($decodedResult, $xmlElement); print_r($xmlElement->xpath('//albumcover/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.0180.00316.75
8.3.50.0070.00718.18
8.3.40.0090.00618.95
8.3.30.0070.00719.09
8.3.20.0000.00820.50
8.3.10.0040.00423.82
8.3.00.0080.00019.63
8.2.180.0120.00916.88
8.2.170.0060.01322.96
8.2.160.0100.00320.64
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0070.00417.75
8.2.120.0030.00526.35
8.2.110.0060.00320.60
8.2.100.0000.01218.18
8.2.90.0060.00319.34
8.2.80.0040.00417.97
8.2.70.0060.00617.75
8.2.60.0060.00318.29
8.2.50.0050.00518.07
8.2.40.0080.00019.38
8.2.30.0000.00820.66
8.2.20.0040.00417.90
8.2.10.0080.00018.21
8.2.00.0030.00518.43
8.1.270.0030.00522.31
8.1.260.0000.00828.09
8.1.250.0040.00428.09
8.1.240.0090.00024.07
8.1.230.0080.00417.90
8.1.220.0000.00918.04
8.1.210.0080.00018.77
8.1.200.0050.00517.60
8.1.190.0000.00817.36
8.1.180.0040.00418.10
8.1.170.0040.00419.04
8.1.160.0040.00422.23
8.1.150.0000.00719.15
8.1.140.0040.00419.79
8.1.130.0000.00717.92
8.1.120.0000.00717.63
8.1.110.0000.00717.55
8.1.100.0000.00817.57
8.1.90.0040.00417.69
8.1.80.0000.00817.67
8.1.70.0030.00317.55
8.1.60.0030.00517.72
8.1.50.0070.00417.64
8.1.40.0040.00417.74
8.1.30.0000.00817.80
8.1.20.0030.00517.88
8.1.10.0050.00217.65
8.1.00.0040.00717.72
8.0.300.0040.00418.77
8.0.290.0000.00916.88
8.0.280.0070.00018.48
8.0.270.0000.00717.46
8.0.260.0000.00617.36
8.0.250.0070.00017.09
8.0.240.0030.00617.08
8.0.230.0070.00017.10
8.0.220.0000.00717.08
8.0.210.0070.00017.16
8.0.200.0040.00417.16
8.0.190.0060.00317.26
8.0.180.0000.00717.06
8.0.170.0060.00317.09
8.0.160.0000.00717.20
8.0.150.0040.00416.96
8.0.140.0000.00717.10
8.0.130.0030.00313.53
8.0.120.0040.00417.02
8.0.110.0040.00417.06
8.0.100.0000.00717.09
8.0.90.0070.00017.01
8.0.80.0060.00917.09
8.0.70.0060.00317.00
8.0.60.0020.00517.08
8.0.50.0030.00517.02
8.0.30.0100.01217.34
8.0.20.0090.00917.41
8.0.10.0040.00417.30
8.0.00.0020.01516.99
7.4.330.0000.00515.30
7.4.320.0030.00316.68
7.4.300.0000.00616.66
7.4.290.0000.00716.70
7.4.280.0030.00516.76
7.4.270.0060.00016.71
7.4.260.0000.00716.55
7.4.250.0040.00416.75
7.4.240.0040.00416.80
7.4.230.0030.00316.82
7.4.220.0120.01016.75
7.4.210.0090.00816.74
7.4.200.0000.00716.42
7.4.160.0000.01516.77
7.4.150.0030.01417.40
7.4.140.0100.01517.86
7.4.130.0080.01016.75
7.4.120.0120.00516.77
7.4.110.0140.00316.70
7.4.100.0130.01016.63
7.4.90.0070.01316.59
7.4.80.0090.00919.39
7.4.70.0070.01116.64
7.4.60.0100.00616.56
7.4.50.0050.00216.65
7.4.40.0110.01116.88
7.4.30.0150.00416.59
7.4.00.0030.01314.92
7.3.330.0030.00313.40
7.3.320.0000.00513.57
7.3.310.0040.00416.57
7.3.300.0030.00316.61
7.3.290.0000.00716.56
7.3.280.0100.00716.56
7.3.270.0000.01717.40
7.3.260.0100.00716.53
7.3.250.0110.00916.60
7.3.240.0130.00516.57
7.3.230.0070.01316.85
7.3.210.0110.00616.60
7.3.200.0090.00616.57
7.3.190.0060.00916.57
7.3.180.0090.00616.57
7.3.170.0190.00316.61
7.3.160.0080.00816.52
7.3.120.0100.01014.99
7.3.110.0140.00414.96
7.3.100.0100.00715.10
7.3.90.0040.00714.88
7.3.80.0070.01014.98
7.3.70.0040.01114.87
7.3.60.0090.00614.90
7.3.50.0080.00314.95
7.3.40.0040.01214.80
7.3.30.0040.00714.95
7.3.20.0070.00716.90
7.3.10.0090.00616.78
7.3.00.0000.01316.75
7.2.330.0060.01116.61
7.2.320.0040.01516.85
7.2.310.0060.01116.72
7.2.300.0120.00616.68
7.2.290.0060.01216.84
7.2.250.0000.01315.05
7.2.240.0080.01214.93
7.2.230.0030.01315.10
7.2.220.0090.00615.24
7.2.210.0120.00914.89
7.2.200.0030.00715.28
7.2.190.0040.01115.03
7.2.180.0000.01215.10
7.2.170.0060.01015.27
7.2.60.0030.01217.06
7.2.00.0040.00819.64
7.1.330.0030.00915.88
7.1.320.0100.00315.73
7.1.310.0070.01015.73
7.1.300.0000.01215.81
7.1.290.0040.00816.17
7.1.280.0030.01015.84
7.1.270.0070.00715.79
7.1.260.0130.00315.91
7.1.200.0000.01216.04
7.1.100.0000.01018.11
7.1.70.0040.00417.21
7.1.60.0060.01919.48
7.1.50.0090.01216.99
7.1.00.0030.07722.59
7.0.200.0030.01015.12
7.0.60.0030.05319.99
7.0.50.0030.04017.93
7.0.40.0030.07320.20
7.0.30.0370.07720.28
7.0.20.0230.04020.29
7.0.10.0070.04720.31
7.0.00.0030.06020.32
5.6.280.0030.05720.97
5.6.210.0270.06720.67
5.6.200.0100.05318.28
5.6.190.0100.06020.53
5.6.180.0200.04720.77
5.6.170.0400.04720.78
5.6.160.0000.05720.62
5.6.150.0130.07318.38
5.6.140.0030.07718.31
5.6.130.0100.08018.27
5.6.120.0130.07721.20
5.6.110.0170.07021.04
5.6.100.0030.04321.19
5.6.90.0070.03721.17
5.6.80.0130.07320.44
5.5.350.3700.04720.55
5.5.340.0100.07318.20
5.5.330.0030.08320.34
5.5.320.0200.03720.34
5.5.310.0200.04020.38
5.5.300.0030.08318.14
5.5.290.0000.04317.98
5.5.280.0170.07020.78
5.5.270.0130.08020.88
5.5.260.0070.04320.98
5.5.250.0170.04320.65
5.5.240.0030.07020.32

preferences:
92.94 ms | 400 KiB | 5 Q