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); $url = (string) $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.0110.00417.00
8.3.50.0140.00322.18
8.3.40.0040.01118.94
8.3.30.0070.00718.98
8.3.20.0060.00322.34
8.3.10.0080.00023.98
8.3.00.0080.00019.50
8.2.180.0110.01118.80
8.2.170.0140.00022.96
8.2.160.0060.00920.73
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00717.71
8.2.120.0060.00326.35
8.2.110.0100.00019.61
8.2.100.0090.00418.30
8.2.90.0040.00719.48
8.2.80.0030.00518.13
8.2.70.0000.00817.87
8.2.60.0000.00818.18
8.2.50.0040.00418.13
8.2.40.0040.00419.64
8.2.30.0000.00820.82
8.2.20.0040.00417.96
8.2.10.0040.00418.57
8.2.00.0040.00418.41
8.1.280.0070.01525.92
8.1.270.0080.00022.39
8.1.260.0040.00428.09
8.1.250.0020.00528.09
8.1.240.0060.00319.34
8.1.230.0060.00618.16
8.1.220.0000.00818.04
8.1.210.0050.00318.77
8.1.200.0060.00317.72
8.1.190.0050.00317.38
8.1.180.0000.00818.10
8.1.170.0050.00318.99
8.1.160.0040.00422.25
8.1.150.0020.00519.22
8.1.140.0000.00919.86
8.1.130.0030.00317.93
8.1.120.0000.00817.82
8.1.110.0000.00717.83
8.1.100.0030.00617.74
8.1.90.0050.00317.67
8.1.80.0040.00417.64
8.1.70.0030.00317.78
8.1.60.0040.00417.92
8.1.50.0080.00417.91
8.1.40.0000.00817.77
8.1.30.0030.00618.00
8.1.20.0040.00417.94
8.1.10.0000.00817.68
8.1.00.0090.00317.81
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0070.00018.83
8.0.270.0000.00717.49
8.0.260.0070.00017.50
8.0.250.0070.00017.37
8.0.240.0000.00717.38
8.0.230.0070.00017.34
8.0.220.0000.00717.29
8.0.210.0000.00717.32
8.0.200.0000.01017.39
8.0.190.0000.00817.45
8.0.180.0000.00717.40
8.0.170.0020.00517.11
8.0.160.0000.00817.32
8.0.150.0070.00017.24
8.0.140.0040.00417.10
8.0.130.0060.00013.68
8.0.120.0050.00217.14
8.0.110.0040.00417.12
8.0.100.0040.00417.20
8.0.90.0030.00617.21
8.0.80.0060.00917.18
8.0.70.0040.00417.17
8.0.60.0040.00417.19
8.0.50.0030.00517.29
8.0.30.0080.00817.30
8.0.20.0080.01117.44
8.0.10.0040.00417.40
8.0.00.0100.00817.10
7.4.330.0000.00515.47
7.4.320.0000.00716.68
7.4.300.0030.00316.89
7.4.290.0070.00016.91
7.4.280.0030.00516.95
7.4.270.0000.00716.97
7.4.260.0030.00316.87
7.4.250.0030.00516.87
7.4.240.0060.00116.84
7.4.230.0000.00716.88
7.4.220.0110.00816.99
7.4.210.0060.00816.91
7.4.200.0040.00416.87
7.4.160.0090.00616.82
7.4.150.0070.01017.40
7.4.140.0160.00617.86
7.4.130.0160.00016.80
7.4.120.0120.00916.93
7.4.110.0100.01416.64
7.4.100.0120.00916.82
7.4.90.0000.01716.89
7.4.80.0130.00319.39
7.4.70.0080.00816.95
7.4.60.0060.01016.82
7.4.50.0000.00916.77
7.4.40.0110.00616.56
7.4.30.0030.01316.68
7.4.00.0070.00715.29
7.3.330.0000.00513.79
7.3.320.0050.00013.80
7.3.310.0000.00716.70
7.3.300.0000.00716.78
7.3.290.0030.00316.82
7.3.280.0080.00816.71
7.3.270.0070.01017.40
7.3.260.0100.00716.98
7.3.240.0150.00516.87
7.3.230.0030.01416.90
7.3.210.0160.00316.70
7.3.200.0050.01116.90
7.3.190.0060.01216.73
7.3.180.0170.00316.84
7.3.170.0090.00916.94
7.3.160.0030.02016.80
7.3.10.0090.00516.67
7.3.00.0090.00616.85
7.2.330.0070.01016.93
7.2.320.0030.01317.03
7.2.310.0070.01117.18
7.2.300.0030.01417.09
7.2.290.0150.00316.70
7.2.130.0030.01017.20
7.2.120.0070.00916.86
7.2.110.0100.00416.99
7.2.100.0070.00417.07
7.2.90.0070.00717.10
7.2.80.0080.00717.03
7.2.70.0030.00816.99
7.2.60.0050.00816.95
7.2.50.0090.00517.03
7.2.40.0070.00717.23
7.2.30.0090.00516.95
7.2.20.0060.00616.86
7.2.10.0030.00717.02
7.2.00.0070.00817.79
7.1.250.0050.00815.93
7.1.100.0100.00318.63
7.1.70.0040.00417.51
7.1.60.0100.01419.48
7.1.50.0080.01517.13
7.1.00.0030.07722.58
7.0.200.0260.00015.30
7.0.60.0070.08719.99
7.0.50.0100.08018.01
7.0.40.0000.08720.55
7.0.30.0230.06320.48
7.0.20.0170.08720.49
7.0.10.0070.06020.38
7.0.00.0130.07720.28
5.6.280.0000.05321.17
5.6.210.0070.08720.81
5.6.200.0070.04018.40
5.6.190.0030.09320.82
5.6.180.0200.04020.63
5.6.170.0270.08020.76
5.6.160.0200.06020.72
5.6.150.0130.05718.30
5.6.140.0100.04018.39
5.6.130.0030.04318.34
5.6.120.0100.08021.25
5.6.110.0030.05721.17
5.6.100.0130.03021.27
5.6.90.0070.06021.19
5.6.80.0200.06720.66
5.5.350.4430.04320.62
5.5.340.0030.04718.18
5.5.330.0100.04020.43
5.5.320.0500.04720.41
5.5.310.0330.03720.41
5.5.300.0030.03718.19
5.5.290.0030.04018.16
5.5.280.0100.04321.10
5.5.270.0070.06720.84
5.5.260.0070.05020.95
5.5.250.0200.07320.82
5.5.240.0030.06720.56

preferences:
68.08 ms | 401 KiB | 5 Q