3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convert($xml) { $simpleXmlObj = simplexml_load_string($xml); $simpleXmlObj = _fixVersionDifferences($simpleXmlObj); $array = _simpleXmlObj2Array($simpleXmlObj); return $array; } function _fixVersionDifferences($simpleXmlObj) { $simpleXmlObj = _fixEmptyStringDifference($simpleXmlObj); return $simpleXmlObj; } function _fixEmptyStringDifference($simpleXmlObj) { foreach (get_object_vars($simpleXmlObj) as $key => $element) { if ($element instanceof \SimpleXMLElement) { $simpleXmlObj->$key = _fixEmptyStringDifference($element); } if ($element != 0 && empty($element)) { unset($simpleXmlObj->$key); } } return $simpleXmlObj; } function _simpleXmlObj2Array($simpleXmlObj) { //Maybe it is not fast but the easiest way to convert return json_decode(json_encode($simpleXmlObj), TRUE); } $xml = <<<xml <?xml version="1.0" encoding="utf-8"?> <RESPONSE> <SUCCESS>true</SUCCESS> <ERRORMESSAGE> </ERRORMESSAGE> <TIMESTAMP>21/09/2015 03:26:37</TIMESTAMP> </RESPONSE> xml; $response = convert($xml); print_r($response);

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.00416.61
8.3.50.0120.01021.23
8.3.40.0060.00918.82
8.3.30.0120.00419.02
8.3.20.0050.00220.43
8.3.10.0000.01021.90
8.3.00.0080.00019.81
8.2.180.0150.00016.73
8.2.170.0120.00322.96
8.2.160.0060.00920.61
8.2.150.0080.00024.18
8.2.140.0110.00824.66
8.2.130.0000.00826.16
8.2.120.0040.00417.75
8.2.110.0060.00322.39
8.2.100.0000.01217.75
8.2.90.0040.00419.30
8.2.80.0030.00517.97
8.2.70.0040.00417.63
8.2.60.0030.00618.18
8.2.50.0070.00418.07
8.2.40.0080.00021.23
8.2.30.0030.00618.17
8.2.20.0000.00717.90
8.2.10.0000.00818.39
8.2.00.0080.00018.23
8.1.280.0000.01725.92
8.1.270.0040.00420.63
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00322.64
8.1.230.0090.00317.61
8.1.220.0030.00517.80
8.1.210.0050.00318.77
8.1.200.0030.01017.48
8.1.190.0040.00417.48
8.1.180.0060.00318.10
8.1.170.0000.00818.86
8.1.160.0000.00822.12
8.1.150.0000.00719.19
8.1.140.0000.00817.68
8.1.130.0030.00320.25
8.1.120.0040.00417.61
8.1.110.0000.00817.57
8.1.100.0000.00917.54
8.1.90.0070.00017.66
8.1.80.0040.00417.55
8.1.70.0000.00717.57
8.1.60.0080.00017.66
8.1.50.0030.00617.70
8.1.40.0040.00417.76
8.1.30.0000.00917.80
8.1.20.0040.00417.68
8.1.10.0040.00417.71
8.1.00.0000.00817.60
8.0.300.0040.00418.77
8.0.290.0000.00917.00
8.0.280.0030.00318.54
8.0.270.0050.00217.45
8.0.260.0000.00722.00
8.0.250.0070.00017.11
8.0.240.0030.00517.08
8.0.230.0040.00417.11
8.0.220.0000.00817.07
8.0.210.0050.00217.14
8.0.200.0000.00717.18
8.0.190.0050.00317.21
8.0.180.0000.00717.21
8.0.170.0040.00417.09
8.0.160.0040.00417.17
8.0.150.0000.00816.94
8.0.140.0050.00317.08
8.0.130.0050.00013.51
8.0.120.0040.00417.07
8.0.110.0000.00717.13
8.0.100.0040.00417.12
8.0.90.0000.00717.07
8.0.80.0030.01317.20
8.0.70.0000.00717.26
8.0.60.0080.00016.99
8.0.50.0040.00417.23
8.0.30.0110.00717.27
8.0.20.0130.00417.40
8.0.10.0070.00017.32
8.0.00.0060.01116.76
7.4.330.0040.00415.08
7.4.320.0000.00616.78
7.4.300.0030.00316.85
7.4.290.0060.00316.74
7.4.280.0000.00716.75
7.4.270.0000.00716.84
7.4.260.0050.00316.81
7.4.250.0040.00416.72
7.4.240.0050.00216.78
7.4.230.0000.00716.74
7.4.220.0070.01716.92
7.4.210.0100.00316.66
7.4.200.0040.00416.86
7.4.160.0090.01316.58
7.4.150.0180.00017.40
7.4.140.0160.00817.86
7.4.130.0110.00716.71
7.4.120.0120.01116.55
7.4.110.0070.01016.86
7.4.100.0120.01216.88
7.4.90.0090.00916.76
7.4.80.0080.00819.39
7.4.70.0090.00916.81
7.4.60.0070.01016.71
7.4.50.0000.00916.53
7.4.40.0040.01216.79
7.4.30.0110.00616.78
7.4.10.0100.00714.90
7.4.00.0050.01114.96
7.3.330.0000.00613.39
7.3.320.0000.00513.57
7.3.310.0070.00016.54
7.3.300.0030.00316.52
7.3.290.0090.00816.64
7.3.280.0120.00616.64
7.3.270.0070.01317.40
7.3.260.0180.00016.79
7.3.250.0090.00816.67
7.3.240.0110.00716.67
7.3.230.0030.01916.67
7.3.210.0120.00616.57
7.3.200.0040.01216.85
7.3.190.0130.00416.66
7.3.180.0070.01016.85
7.3.170.0140.00316.65
7.3.160.0170.00016.64
7.3.130.0110.00414.95
7.3.120.0050.01214.90
7.3.110.0090.00715.05
7.3.100.0100.00514.95
7.3.90.0020.01515.04
7.3.80.0040.00715.10
7.3.70.0010.01114.90
7.3.60.0030.00914.97
7.3.50.0020.00814.86
7.3.40.0050.01014.96
7.3.30.0070.00514.88
7.3.20.0090.00216.63
7.3.10.0060.00916.74
7.3.00.0030.01116.73
7.2.330.0090.00916.89
7.2.320.0060.01216.93
7.2.310.0070.01416.65
7.2.300.0200.00316.92
7.2.290.0060.01316.76
7.2.260.0090.00915.28
7.2.250.0040.01415.26
7.2.240.0000.01415.14
7.2.230.0090.00715.16
7.2.220.0090.00515.29
7.2.210.0030.01215.37
7.2.200.0020.01415.09
7.2.190.0060.00915.20
7.2.180.0050.01015.06
7.2.170.0050.00815.05
7.2.160.0070.00615.01
7.2.150.0020.00817.02
7.2.140.0080.00716.91
7.2.130.0050.00817.03
7.2.120.0050.00916.95
7.2.110.0030.01017.05
7.2.100.0060.00617.07
7.2.90.0040.00817.02
7.2.80.0050.00517.06
7.2.70.0040.01017.02
7.2.60.0050.01016.98
7.2.50.0050.00817.00
7.2.40.0060.00817.03
7.2.30.0090.00317.06
7.2.20.0060.00716.96
7.2.10.0070.00417.02
7.2.00.0070.00817.58
7.1.330.0030.01115.96
7.1.320.0050.00515.89
7.1.310.0050.00815.88
7.1.300.0050.00615.72
7.1.290.0030.00615.82
7.1.280.0020.01015.88
7.1.270.0040.00615.88
7.1.260.0060.00815.96
7.1.250.0070.00615.84
7.1.240.0060.00715.78
7.1.230.0050.00915.87
7.1.220.0040.00915.86
7.1.210.0070.00515.76
7.1.200.0070.00515.88
7.1.190.0060.00615.87
7.1.180.0030.00915.95
7.1.170.0030.00916.00
7.1.160.0060.00815.73
7.1.150.0050.00715.67
7.1.140.0060.00615.77
7.1.130.0070.00515.83
7.1.120.0090.00615.90
7.1.110.0040.00715.90
7.1.100.0040.00816.54
7.1.90.0030.00515.80
7.1.80.0090.00515.86
7.1.70.0030.00916.37
7.1.60.0090.01017.29
7.1.50.0060.01216.16
7.1.40.0100.00015.80
7.1.30.0070.00415.74
7.1.20.0060.00815.86
7.1.10.0120.00115.89
7.1.00.0020.03218.13
7.0.330.0070.00315.41
7.0.320.0040.00715.36
7.0.310.0040.00615.51
7.0.300.0050.00615.33
7.0.290.0050.00715.45
7.0.280.0020.01015.55
7.0.270.0060.00815.57
7.0.260.0120.00015.51
7.0.250.0050.00515.45
7.0.240.0050.00515.65
7.0.230.0070.00315.68
7.0.220.0100.00515.36
7.0.210.0050.00415.52
7.0.200.0140.00715.38
7.0.190.0090.00415.61
7.0.180.0020.01115.56
7.0.170.0030.01015.55
7.0.160.0060.01115.60
7.0.150.0080.00515.47
7.0.140.0070.00915.37
7.0.130.0020.00815.43
7.0.120.0120.00515.53
7.0.110.0110.00615.55
7.0.100.0060.00615.30
7.0.90.0180.02217.08
7.0.80.0220.03016.98
7.0.70.0210.03417.11
7.0.60.0190.03516.95
7.0.50.0200.03117.26
7.0.40.0100.01815.71
7.0.30.0060.02715.86
7.0.20.0030.02715.79
7.0.10.0110.02515.72
7.0.00.0080.01615.72
5.6.400.0070.01014.56
5.6.390.0060.00614.43
5.6.380.0070.00514.49
5.6.370.0080.00514.56
5.6.360.0070.00514.56
5.6.350.0090.00514.52
5.6.340.0020.01114.48
5.6.330.0090.00714.31
5.6.320.0050.00914.51
5.6.310.0070.00814.74
5.6.300.0060.01114.75
5.6.290.0030.01014.57
5.6.280.0060.01816.77
5.6.270.0060.01014.64
5.6.260.0030.01214.61
5.6.250.0030.01114.47
5.6.240.0060.00614.37
5.6.230.0060.03516.69
5.6.220.0060.02716.73
5.6.210.0050.02316.57
5.6.200.0050.02216.66
5.6.190.0070.03116.65
5.6.180.0070.03116.56
5.6.170.0070.03016.57
5.6.160.0070.01916.65
5.6.150.0020.03616.68
5.6.140.0070.03016.75
5.6.130.0040.03716.66
5.6.120.0040.03616.74
5.6.110.0080.03016.61
5.6.100.0050.02216.72
5.6.90.0120.02616.76
5.6.80.0080.02816.65
5.6.70.0040.03316.54
5.6.60.0100.02416.27
5.6.50.0060.02616.52
5.6.40.0050.03516.27
5.6.30.0100.02716.45
5.6.20.0050.03116.44
5.6.10.0060.02016.48
5.6.00.0060.03116.44
5.5.380.0100.00514.37
5.5.370.0080.02616.51
5.5.360.0080.02916.47
5.5.350.0080.03116.56
5.5.340.0080.02616.51
5.5.330.0040.01816.53
5.5.320.0050.03116.65
5.5.310.0080.03316.63
5.5.300.0050.03016.50
5.5.290.0060.03516.60
5.5.280.0060.03216.64
5.5.270.0090.03016.46
5.5.260.0100.03016.60
5.5.250.0050.03316.54
5.5.240.0030.03416.42
5.5.230.0030.03416.38
5.5.220.0080.03016.25
5.5.210.0090.02816.29
5.5.200.0100.02516.22
5.5.190.0030.03116.31
5.5.180.0080.02916.38
5.5.170.0060.00614.25
5.5.160.0080.03116.40
5.5.150.0060.02816.32
5.5.140.0050.01716.37
5.5.130.0050.03216.35
5.5.120.0060.03016.42
5.5.110.0060.03116.27
5.5.100.0070.02716.40
5.5.90.0070.02916.18
5.5.80.0080.02716.15
5.5.70.0040.03216.25
5.5.60.0070.02916.23
5.5.50.0110.02716.30
5.5.40.0030.03316.23
5.5.30.0080.02516.31
5.5.20.0070.02816.24
5.5.10.0060.03016.35
5.5.00.0040.03416.18
5.4.450.0090.02614.37
5.4.440.0100.02314.43
5.4.430.0060.02814.38
5.4.420.0060.02314.46
5.4.410.0100.02714.30
5.4.400.0030.02114.31
5.4.390.0010.03314.23
5.4.380.0070.02914.23
5.4.370.0060.02814.17
5.4.360.0050.03114.34
5.4.350.0040.03014.20
5.4.340.0040.02514.21
5.4.330.0020.00711.65
5.4.320.0040.02614.32
5.4.310.0040.02914.30
5.4.300.0080.02714.29
5.4.290.0020.02114.35
5.4.280.0020.03114.23
5.4.270.0070.02714.16
5.4.260.0060.02414.32
5.4.250.0060.02914.24
5.4.240.0020.02914.17
5.4.230.0070.01614.23
5.4.220.0090.02614.29
5.4.210.0060.02814.25
5.4.200.0070.03014.19
5.4.190.0040.03114.08
5.4.180.0090.01814.17
5.4.170.0030.02914.13
5.4.160.0070.01614.24
5.4.150.0050.02814.14
5.4.140.0040.01513.35
5.4.130.0050.03013.28
5.4.120.0060.02613.42
5.4.110.0040.02013.32
5.4.100.0060.02113.38
5.4.90.0050.02813.35
5.4.80.0050.01913.41
5.4.70.0050.02913.41
5.4.60.0040.02013.33
5.4.50.0010.01913.35
5.4.40.0070.02713.36
5.4.30.0040.02513.27
5.4.20.0060.02713.35
5.4.10.0030.01913.38
5.4.00.0050.02713.19
5.3.290.0100.07314.89
5.3.280.0030.07714.73
5.3.270.0100.05714.79
5.3.260.0130.04714.86
5.3.250.0100.07314.87
5.3.240.0100.06314.79
5.3.230.0130.06014.85
5.3.220.0030.07714.79
5.3.210.0170.06714.84
5.3.200.0230.05314.62
5.3.190.0130.04314.71
5.3.180.0030.07314.73
5.3.170.0070.04714.82
5.3.160.0100.07014.74
5.3.150.0070.06314.71
5.3.140.0070.07714.82
5.3.130.0030.08014.82
5.3.120.0070.05314.72
5.3.110.0200.03314.82
5.3.100.0100.05014.21
5.3.90.0000.07314.15
5.3.80.0170.06314.00
5.3.70.0170.06014.27
5.3.60.0070.07714.14
5.3.50.0100.04014.21
5.3.40.0130.07314.18
5.3.30.0070.07314.16
5.3.20.0070.05013.95
5.3.10.0100.04713.64
5.3.00.0000.05313.90
5.2.170.0170.02311.15
5.2.160.0030.06711.41
5.2.150.0070.06011.39
5.2.140.0130.05711.13
5.2.130.0000.04711.28
5.2.120.0100.05311.17
5.2.110.0070.06311.32
5.2.100.0070.06011.17
5.2.90.0030.04011.23
5.2.80.0030.06711.24
5.2.70.0000.07311.23
5.2.60.0070.03711.23
5.2.50.0030.05011.26
5.2.40.0000.06711.22
5.2.30.0070.03711.15
5.2.20.0000.04011.17
5.2.10.0070.05711.09
5.2.00.0070.05710.80
5.1.60.0030.03310.13
5.1.50.0070.0539.99
5.1.40.0030.05310.05
5.1.30.0030.05710.34
5.1.20.0000.06010.34
5.1.10.0070.05310.14
5.1.00.0030.05710.21
5.0.50.0000.0478.70
5.0.40.0000.0338.59
5.0.30.0030.0538.22
5.0.20.0030.0378.09
5.0.10.0030.0338.07
5.0.00.0100.0338.15
4.4.90.0000.0407.11
4.4.80.0000.0207.11
4.4.70.0070.0337.11
4.4.60.0000.0337.11
4.4.50.0070.0377.11
4.4.40.0030.0537.11
4.4.30.0030.0237.11
4.4.20.0000.0377.11
4.4.10.0070.0337.11
4.4.00.0000.0577.11
4.3.110.0000.0407.11
4.3.100.0030.0377.11
4.3.90.0070.0307.11
4.3.80.0000.0477.11
4.3.70.0000.0377.11
4.3.60.0070.0237.11
4.3.50.0030.0237.11
4.3.40.0000.0477.11
4.3.30.0000.0337.11
4.3.20.0000.0237.11
4.3.10.0030.0337.11
4.3.00.0030.0337.11

preferences:
58.85 ms | 401 KiB | 5 Q