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); var_dump($xmlElement->xpath('/root/albums/*/albumcover/*/url[1]')[0]);

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.0040.01116.88
8.3.50.0160.00622.11
8.3.40.0070.00719.12
8.3.30.0000.01418.95
8.3.20.0060.00320.59
8.3.10.0000.00723.89
8.3.00.0060.00319.75
8.2.180.0000.01618.79
8.2.170.0110.00322.96
8.2.160.0000.01420.68
8.2.150.0090.00024.18
8.2.140.0000.00824.66
8.2.130.0070.00718.00
8.2.120.0040.00426.35
8.2.110.0090.00020.82
8.2.100.0220.00818.29
8.2.90.0000.01019.54
8.2.80.0030.00518.13
8.2.70.0090.00017.75
8.2.60.0040.00418.18
8.2.50.0000.00818.07
8.2.40.0040.00419.48
8.2.30.0080.00021.02
8.2.20.0080.00018.00
8.2.10.0040.00418.37
8.2.00.0040.00418.56
8.1.280.0090.00625.92
8.1.270.0040.00422.36
8.1.260.0040.00428.09
8.1.250.0000.00728.09
8.1.240.0090.00022.79
8.1.230.0050.00518.04
8.1.220.0030.00518.03
8.1.210.0040.00418.77
8.1.200.0000.00917.47
8.1.190.0000.00917.38
8.1.180.0000.00918.10
8.1.170.0000.00918.84
8.1.160.0080.00022.41
8.1.150.0000.00719.36
8.1.140.0030.00519.89
8.1.130.0000.00718.09
8.1.120.0070.00017.69
8.1.110.0080.00017.70
8.1.100.0080.00017.83
8.1.90.0000.00817.80
8.1.80.0070.00017.62
8.1.70.0070.00017.54
8.1.60.0000.00817.93
8.1.50.0090.00317.74
8.1.40.0040.00417.84
8.1.30.0060.00317.90
8.1.20.0000.00817.84
8.1.10.0040.00417.73
8.1.00.0040.00717.78
8.0.300.0000.00718.77
8.0.290.0000.00817.13
8.0.280.0000.00718.68
8.0.270.0050.00217.51
8.0.260.0000.00717.55
8.0.250.0070.00017.24
8.0.240.0000.00717.38
8.0.230.0000.00817.41
8.0.220.0030.00317.32
8.0.210.0000.00717.24
8.0.200.0000.00717.22
8.0.190.0030.00517.48
8.0.180.0050.00217.24
8.0.170.0040.00417.17
8.0.160.0000.00817.35
8.0.150.0040.00417.18
8.0.140.0070.00017.26
8.0.130.0000.00513.68
8.0.120.0030.00517.17
8.0.110.0050.00317.24
8.0.100.0040.00417.23
8.0.90.0000.00717.14
8.0.80.0130.00317.22
8.0.70.0080.00017.32
8.0.60.0000.00817.23
8.0.50.0020.00517.13
8.0.30.0120.00717.53
8.0.20.0120.00817.50
8.0.10.0040.00417.30
8.0.00.0090.00817.09
7.4.330.0060.00015.57
7.4.320.0030.00316.85
7.4.300.0030.00316.86
7.4.290.0030.00316.98
7.4.280.0040.00416.94
7.4.270.0030.00316.93
7.4.260.0030.00316.80
7.4.250.0050.00316.86
7.4.240.0050.00216.92
7.4.230.0000.00716.75
7.4.220.0150.00616.98
7.4.210.0090.00816.87
7.4.200.0050.00216.88
7.4.160.0090.00616.85
7.4.150.0120.00617.40
7.4.140.0100.01417.86
7.4.130.0130.01016.99
7.4.120.0120.00916.96
7.4.110.0070.01316.70
7.4.100.0070.01417.01
7.4.90.0120.00616.71
7.4.80.0200.00319.39
7.4.70.0070.01016.84
7.4.60.0130.00416.76
7.4.50.0000.00816.99
7.4.40.0030.01516.84
7.4.30.0100.00916.92
7.4.00.0110.00415.46
7.3.330.0040.00413.63
7.3.320.0030.00313.68
7.3.310.0030.00316.79
7.3.300.0040.00416.77
7.3.290.0000.00716.66
7.3.280.0080.01016.77
7.3.270.0110.00617.40
7.3.260.0110.00616.71
7.3.240.0060.01116.75
7.3.230.0090.00816.71
7.3.210.0180.00416.66
7.3.200.0070.01316.98
7.3.190.0170.00416.79
7.3.180.0030.01316.73
7.3.170.0130.00416.82
7.3.160.0100.00616.98
7.2.330.0120.01217.15
7.2.320.0090.00816.77
7.2.310.0100.00616.94
7.2.300.0130.01016.78
7.2.290.0110.00617.05
7.2.80.0030.01017.04
7.2.60.0030.01317.27
7.2.00.0000.01719.18
7.1.200.0080.00315.86
7.1.100.0030.01218.25
7.1.70.0070.00317.36
7.1.60.0130.01319.48
7.1.50.0150.00616.91
7.1.00.0070.07322.62
7.0.200.0370.00714.96
7.0.60.0170.03020.09
7.0.50.0000.04318.08
7.0.40.0100.04020.41
7.0.30.0370.08020.39
7.0.20.0230.04720.29
7.0.10.0070.05320.39
7.0.00.0030.08720.38
5.6.280.0030.04721.16
5.6.210.0170.07720.79
5.6.200.0070.08018.39
5.6.190.0070.04320.67
5.6.180.0300.05020.89
5.6.170.0300.08020.81
5.6.160.0030.05720.62
5.6.150.0170.05718.39
5.6.140.0070.08018.38
5.6.130.0130.08018.34
5.6.120.0100.08021.13
5.6.110.0030.08021.08
5.6.100.0030.04021.08
5.6.90.0030.04321.25
5.6.80.0130.07720.68
5.5.350.3530.03720.54
5.5.340.0070.06718.21
5.5.330.0130.07720.64
5.5.320.0470.03020.58
5.5.310.0170.03720.57
5.5.300.0030.08018.27
5.5.290.0000.04318.18
5.5.280.0230.06321.09
5.5.270.0130.07320.82
5.5.260.0170.06721.16
5.5.250.0030.09020.64
5.5.240.0430.05020.39

preferences:
41.01 ms | 401 KiB | 5 Q