3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); function & XML_serialize(&$data, $level = 0, $prior_key = NULL){ #assumes a hash, keys are the variable names $xml_serialized_string = ""; while(list($key, $value) = each($data)){ $inline = false; $numeric_array = false; $attributes = ""; #echo "My current key is '$key', called with prior key '$prior_key'<br>"; if(!strstr($key, " attr")){ #if it's not an attribute if(array_key_exists("$key attr", $data)){ while(list($attr_name, $attr_value) = each($data["$key attr"])){ #echo "Found attribute $attribute_name with value $attribute_value<br>"; $attr_value = &htmlspecialchars($attr_value, ENT_QUOTES); $attributes .= " $attr_name=\"$attr_value\""; } } if(is_numeric($key)){ #echo "My current key ($key) is numeric. My parent key is '$prior_key'<br>"; $key = $prior_key; }else{ #you can't have numeric keys at two levels in a row, so this is ok #echo "Checking to see if a numeric key exists in data."; if(is_array($value) and array_key_exists(0, $value)){ # echo " It does! Calling myself as a result of a numeric array.<br>"; $numeric_array = true; $xml_serialized_string .= XML_serialize($value, $level, $key); } #echo "<br>"; } if(!$numeric_array){ $xml_serialized_string .= str_repeat("\t", $level) . "<$key$attributes>"; if(is_array($value)){ $xml_serialized_string .= "\r\n" . XML_serialize($value, $level+1); }else{ $inline = true; $xml_serialized_string .= htmlspecialchars($value); } $xml_serialized_string .= (!$inline ? str_repeat("\t", $level) : "") . "</$key>\r\n"; } }else{ #echo "Skipping attribute record for key $key<bR>"; } } if($level == 0){ $xml_serialized_string = "<?xml version=\"1.0\" ?>\r\n" . $xml_serialized_string; return $xml_serialized_string; }else{ return $xml_serialized_string; } }

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.0070.01016.63
8.3.50.0120.00422.92
8.3.40.0170.00318.68
8.3.30.0030.01019.02
8.3.20.0040.00420.36
8.3.10.0000.00823.53
8.3.00.0030.00619.26
8.2.180.0120.00316.38
8.2.170.0040.01122.96
8.2.160.0030.01220.36
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00021.09
8.2.110.0000.00919.21
8.2.100.0120.00017.78
8.2.90.0040.00418.95
8.2.80.0040.00417.97
8.2.70.0040.00417.13
8.2.60.0000.00817.68
8.2.50.0090.00018.07
8.2.40.0070.00018.09
8.2.30.0040.00419.45
8.2.20.0040.00417.59
8.2.10.0070.00018.02
8.2.00.0040.00417.57
8.1.280.0150.00625.92
8.1.270.0080.00023.70
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00320.87
8.1.230.0070.00317.42
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0090.00017.10
8.1.190.0030.00617.11
8.1.180.0080.00018.10
8.1.170.0000.00918.54
8.1.160.0000.00821.88
8.1.150.0040.00418.70
8.1.140.0030.00617.25
8.1.130.0000.00717.79
8.1.120.0040.00417.44
8.1.110.0030.00617.27
8.1.100.0070.00017.35
8.1.90.0040.00317.35
8.1.80.0000.00717.25
8.1.70.0070.00017.31
8.1.60.0030.00517.48
8.1.50.0040.00417.30
8.1.40.0040.00417.26
8.1.30.0040.00417.56
8.1.20.0040.00417.43
8.1.10.0040.00417.31
8.1.00.0080.00017.23
8.0.300.0040.00418.77
8.0.290.0080.00016.58
8.0.280.0080.00318.33
8.0.270.0030.00517.07
8.0.260.0070.00018.40
8.0.250.0050.00216.73
8.0.240.0000.00716.88
8.0.230.0050.00316.71
8.0.220.0060.00316.82
8.0.210.0030.00316.74
8.0.200.0030.00316.74
8.0.190.0040.00416.84
8.0.180.0030.00516.82
8.0.170.0030.00516.82
8.0.160.0040.00416.64
8.0.150.0020.00516.62
8.0.140.0000.00716.64
8.0.130.0030.00313.26
8.0.120.0040.00416.66
8.0.110.0030.00516.62
8.0.100.0040.00416.82
8.0.90.0000.00716.70
8.0.80.0070.01116.82
8.0.70.0000.00916.66
8.0.60.0000.00816.71
8.0.50.0030.00516.82
8.0.30.0150.00917.10
8.0.20.0130.00617.40
8.0.10.0050.00316.90
8.0.00.0090.01016.69
7.4.330.0000.00515.00
7.4.320.0000.00616.36
7.4.300.0000.00616.50
7.4.290.0030.00316.34
7.4.280.0030.00616.31
7.4.270.0040.00416.41
7.4.260.0000.00916.50
7.4.250.0050.00316.38
7.4.240.0040.00416.47
7.4.230.0030.00316.48
7.4.220.0120.01616.38
7.4.210.0070.00716.43
7.4.200.0070.00016.55
7.4.160.0000.01916.41
7.4.150.0130.00617.40
7.4.140.0140.00617.86
7.4.130.0120.00716.34
7.4.120.0100.00716.34
7.4.110.0090.00916.55
7.4.100.0110.01116.55
7.4.90.0080.01216.39
7.4.80.0060.01219.39
7.4.70.0030.01416.49
7.4.60.0100.00616.55
7.4.50.0040.00416.32
7.4.40.0130.00316.29
7.4.30.0030.01316.33
7.4.10.0100.00714.84
7.4.00.0030.01214.85
7.3.330.0000.00613.07
7.3.320.0030.00313.02
7.3.310.0040.00416.02
7.3.300.0030.00316.25
7.3.290.0130.00316.20
7.3.280.0080.00816.19
7.3.270.0070.01317.40
7.3.260.0090.01516.23
7.3.250.0070.01416.27
7.3.240.0110.00516.33
7.3.230.0110.00716.39
7.3.210.0080.00816.48
7.3.200.0130.00319.39
7.3.190.0090.00916.39
7.3.180.0060.00916.20
7.3.170.0150.00416.27
7.3.160.0160.00016.33
7.3.130.0100.00614.65
7.3.120.0060.01414.72
7.3.110.0050.01014.67
7.3.100.0040.00914.69
7.3.90.0040.01114.81
7.3.80.0030.00914.63
7.3.70.0080.00314.57
7.3.60.0050.00614.63
7.3.50.0050.00914.72
7.3.40.0060.00714.71
7.3.30.0070.00714.59
7.3.20.0060.00516.41
7.3.10.0050.00916.27
7.3.00.0100.00516.34
7.2.330.0130.00316.62
7.2.320.0070.01116.50
7.2.310.0120.00616.34
7.2.300.0100.00716.50
7.2.290.0120.00416.54
7.2.260.0060.01515.09
7.2.250.0070.01214.90
7.2.240.0070.01014.80
7.2.230.0040.01115.00
7.2.220.0040.01114.65
7.2.210.0050.01014.80
7.2.200.0070.00714.85
7.2.190.0050.01014.79
7.2.180.0010.01114.92
7.2.170.0060.00914.87
7.2.160.0030.01014.94
7.2.150.0090.00416.47
7.2.140.0110.00316.70
7.2.130.0060.01116.54
7.2.120.0090.00716.63
7.2.110.0020.01316.59
7.2.100.0070.01016.48
7.2.90.0080.00716.74
7.2.80.0090.00516.83
7.2.70.0000.01316.70
7.2.60.0040.00916.69
7.2.50.0080.00716.52
7.2.40.0060.00816.78
7.2.30.0080.00816.75
7.2.20.0100.00516.76
7.2.10.0010.01016.71
7.2.00.0060.01016.69
7.1.330.0050.01015.50
7.1.320.0060.00815.69
7.1.310.0040.00815.57
7.1.300.0000.00915.57
7.1.290.0030.00815.65
7.1.280.0080.00615.65
7.1.270.0030.00615.69
7.1.260.0080.00815.66
7.1.250.0110.00515.79
7.1.240.0070.00815.73
7.1.230.0020.01115.57
7.1.220.0070.00715.66
7.1.210.0060.00615.67
7.1.200.0050.01015.56
7.1.190.0040.00915.67
7.1.180.0020.00915.76
7.1.170.0020.01115.71
7.1.160.0070.00615.76
7.1.150.0070.01015.62
7.1.140.0020.00915.74
7.1.130.0050.00615.67
7.1.120.0080.00815.56
7.1.110.0050.00515.54
7.1.100.0050.00615.72
7.1.90.0050.00915.66
7.1.80.0080.00615.35
7.1.70.0060.00816.08
7.1.60.0070.00916.89
7.1.50.0030.01116.00
7.1.40.0050.00715.71
7.1.30.0060.00715.64
7.1.20.0090.00615.71
7.1.10.0030.00915.62
7.1.00.0050.03017.98
7.0.330.0070.00615.26
7.0.320.0050.01015.17
7.0.310.0040.00715.23
7.0.300.0030.01015.14
7.0.290.0080.00315.30
7.0.280.0030.01015.21
7.0.270.0080.00515.26
7.0.260.0100.00515.27
7.0.250.0050.00715.28
7.0.240.0020.01215.41
7.0.230.0060.00715.29
7.0.220.0100.00315.32
7.0.210.0060.00815.28
7.0.200.0020.00915.67
7.0.190.0050.00715.37
7.0.180.0050.00915.22
7.0.170.0060.00715.20
7.0.160.0050.00915.28
7.0.150.0030.00815.19
7.0.140.0070.02617.57
7.0.130.0050.01115.32
7.0.120.0050.01015.35
7.0.110.0050.00815.21
7.0.100.0100.00215.23
7.0.90.0020.01115.43
7.0.80.0060.01015.41
7.0.70.0070.00815.45
7.0.60.0100.03016.81
7.0.50.0040.03116.32
7.0.40.0030.02315.61
7.0.30.0070.02415.69
7.0.20.0160.02715.62
7.0.10.0040.03415.56
7.0.00.0020.03615.57
5.6.400.0040.01014.34
5.6.390.0070.00714.03
5.6.380.0000.01214.25
5.6.370.0040.00714.19
5.6.360.0060.00514.15
5.6.350.0050.00714.27
5.6.340.0050.00914.03
5.6.330.0080.00814.20
5.6.320.0030.00714.37
5.6.310.0050.00914.18
5.6.300.0090.00314.14
5.6.290.0050.00914.24
5.6.280.0060.03016.44
5.6.270.0030.00614.00
5.6.260.0050.00914.32
5.6.250.0050.00914.13
5.6.240.0060.00514.24
5.6.230.0080.00314.13
5.6.220.0080.00814.10
5.6.210.0080.03216.36
5.6.200.0030.02115.60
5.6.190.0050.02816.26
5.6.180.0210.02916.15
5.6.170.0140.03016.25
5.6.160.0050.02216.35
5.6.150.0050.03315.46
5.6.140.0060.01515.46
5.6.130.0050.03215.43
5.6.120.0060.01916.52
5.6.110.0050.01916.45
5.6.100.0170.02716.31
5.6.90.0040.03416.49
5.6.80.0050.01816.15
5.6.70.0090.00414.18
5.6.60.0090.00614.23
5.6.50.0080.00714.07
5.6.40.0050.00613.98
5.6.30.0070.00414.03
5.6.20.0030.01014.10
5.6.10.0030.00914.04
5.6.00.0020.01214.09
5.5.380.0060.00514.06
5.5.370.0090.00314.06
5.5.360.0030.01214.12
5.5.350.0100.03116.25
5.5.340.0060.01915.30
5.5.330.0120.02816.16
5.5.320.0130.03416.06
5.5.310.0150.02516.12
5.5.300.0020.02115.20
5.5.290.0050.03515.23
5.5.280.0070.03116.34
5.5.270.0050.02516.13
5.5.260.0010.03816.13
5.5.250.0110.02716.22
5.5.240.0090.03016.00
5.5.230.0080.00514.11
5.5.220.0040.01013.84
5.5.210.0050.01013.97
5.5.200.0110.00313.88
5.5.190.0040.00613.97
5.5.180.0030.01114.03
5.5.170.0030.00914.08
5.5.160.0070.00414.09
5.5.150.0070.00313.95
5.5.140.0030.00913.83
5.5.130.0020.00914.06
5.5.120.0040.00513.88
5.5.110.0070.00714.14
5.5.100.0050.01013.77
5.5.90.0050.01013.88
5.5.80.0060.00714.05
5.5.70.0050.00814.10
5.5.60.0020.00813.97
5.5.50.0100.00514.14
5.5.40.0140.00013.92
5.5.30.0050.00814.03
5.5.20.0020.00914.04
5.5.10.0030.01113.84
5.5.00.0000.00913.63
5.4.450.0130.02014.86
5.4.440.0100.01914.90
5.4.430.0100.01914.94
5.4.420.0080.02014.86
5.4.410.0060.02314.79
5.4.400.0100.02014.81
5.4.390.0080.01414.80
5.4.380.0210.03014.58
5.4.370.0130.02514.64
5.4.360.0160.02014.68
5.4.350.0190.01914.63
5.4.340.0180.02414.61
5.4.330.0020.00712.60
5.4.320.0040.01912.57
5.4.310.0030.01812.57
5.4.300.0030.01912.57
5.4.290.0050.01812.57
5.4.280.0050.01612.53
5.4.270.0050.01412.53
5.4.260.0030.01712.53
5.4.250.0090.01412.53
5.4.240.0050.01612.53
5.4.230.0060.01712.53
5.4.220.0040.01812.53
5.4.210.0050.01612.53
5.4.200.0030.01712.53
5.4.190.0030.01712.53
5.4.180.0060.01412.53
5.4.170.0040.02112.53
5.4.160.0030.01712.53
5.4.150.0050.01712.53
5.4.140.0030.01812.42
5.4.130.0020.01712.42
5.4.120.0040.01612.41
5.4.110.0030.01612.41
5.4.100.0060.01612.41
5.4.90.0040.01712.40
5.4.80.0060.01512.41
5.4.70.0040.01812.40
5.4.60.0050.01512.40
5.4.50.0060.01712.40
5.4.40.0060.01312.40
5.4.30.0050.01312.40
5.4.20.0020.01812.40
5.4.10.0040.01612.40
5.4.00.0060.01712.23
5.3.290.0090.04512.80
5.3.280.0040.04012.70
5.3.270.0110.03912.73
5.3.260.0080.03712.72
5.3.250.0100.03412.72
5.3.240.0140.04712.72
5.3.230.0090.05012.71
5.3.220.0060.03912.68
5.3.210.0130.03612.68
5.3.200.0100.03312.68
5.3.190.0060.04512.68
5.3.180.0090.03312.67
5.3.170.0070.03712.67
5.3.160.0080.03512.67
5.3.150.0110.03412.68
5.3.140.0070.03712.66
5.3.130.0050.04112.65
5.3.120.0050.04512.66
5.3.110.0050.04012.66
5.3.100.0080.03512.14
5.3.90.0050.03712.12
5.3.80.0040.03812.11
5.3.70.0070.03512.11
5.3.60.0030.04112.09
5.3.50.0080.03612.04
5.3.40.0070.04312.04
5.3.30.0070.03512.00
5.3.20.0060.03511.78
5.3.10.0080.03311.75
5.3.00.0040.03911.73
5.2.170.0070.0299.23
5.2.160.0050.0369.24
5.2.150.0070.0369.23
5.2.140.0040.0349.23
5.2.130.0080.0299.19
5.2.120.0040.0309.19
5.2.110.0040.0309.20
5.2.100.0070.0389.19
5.2.90.0080.0389.20
5.2.80.0090.0469.19
5.2.70.0060.0369.19
5.2.60.0060.0309.15
5.2.50.0030.0399.12
5.2.40.0070.0289.09
5.2.30.0090.0269.07
5.2.20.0040.0309.05
5.2.10.0040.0308.96
5.2.00.0060.0288.82
5.1.60.0060.0248.11
5.1.50.0050.0288.11
5.1.40.0030.0308.08
5.1.30.0080.0238.43
5.1.20.0070.0258.46
5.1.10.0060.0308.18
5.1.00.0040.0268.18
5.0.50.0050.0206.66
5.0.40.0050.0196.53
5.0.30.0040.0316.34
5.0.20.0040.0196.30
5.0.10.0050.0186.29
5.0.00.0040.0406.28
4.4.90.0040.0204.78
4.4.80.0040.0224.75
4.4.70.0030.0154.75
4.4.60.0030.0154.76
4.4.50.0030.0154.77
4.4.40.0020.0274.71
4.4.30.0020.0164.76
4.4.20.0020.0164.85
4.4.10.0010.0174.85
4.4.00.0030.0254.76
4.3.110.0020.0184.67
4.3.100.0030.0154.67
4.3.90.0020.0154.64
4.3.80.0030.0294.59
4.3.70.0040.0134.63
4.3.60.0070.0104.63
4.3.50.0050.0134.63
4.3.40.0030.0234.54
4.3.30.0020.0163.33
4.3.20.0030.0153.30
4.3.10.0010.0213.27
4.3.00.0070.02018.56

preferences:
45.22 ms | 400 KiB | 5 Q