3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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.01116.63
8.3.50.0120.00822.95
8.3.40.0040.01118.68
8.3.30.0030.01018.96
8.3.20.0040.00420.20
8.3.10.0000.00823.36
8.3.00.0080.00019.13
8.2.180.0040.01116.38
8.2.170.0110.00422.96
8.2.160.0090.00620.35
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0000.00726.16
8.2.120.0080.00021.01
8.2.110.0000.00919.27
8.2.100.0120.00017.72
8.2.90.0040.00418.92
8.2.80.0050.00317.97
8.2.70.0050.00317.50
8.2.60.0030.00617.93
8.2.50.0040.00418.07
8.2.40.0040.00418.03
8.2.30.0050.00319.51
8.2.20.0080.00017.45
8.2.10.0040.00417.84
8.2.00.0050.00217.59
8.1.280.0180.00325.92
8.1.270.0050.00323.96
8.1.260.0050.00226.35
8.1.250.0000.00728.09
8.1.240.0060.00320.85
8.1.230.0070.00417.42
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0060.00317.23
8.1.190.0080.00017.10
8.1.180.0040.00418.10
8.1.170.0040.00718.51
8.1.160.0030.00521.91
8.1.150.0040.00418.74
8.1.140.0040.00417.38
8.1.130.0000.00717.77
8.1.120.0040.00417.34
8.1.110.0040.00417.38
8.1.100.0050.00317.25
8.1.90.0040.00417.41
8.1.80.0040.00417.34
8.1.70.0000.00717.24
8.1.60.0040.00417.51
8.1.50.0040.00417.49
8.1.40.0040.00417.43
8.1.30.0080.00017.41
8.1.20.0000.00717.46
8.1.10.0000.00817.42
8.1.00.0070.00017.32
8.0.300.0050.00318.77
8.0.290.0000.00716.75
8.0.280.0050.00318.42
8.0.270.0000.00717.11
8.0.260.0040.00418.34
8.0.250.0070.00016.81
8.0.240.0040.00416.74
8.0.230.0030.00316.79
8.0.220.0090.00016.80
8.0.210.0000.00716.76
8.0.200.0070.00016.74
8.0.190.0040.00416.77
8.0.180.0000.00716.88
8.0.170.0050.00316.86
8.0.160.0080.00016.84
8.0.150.0030.00316.55
8.0.140.0000.00716.72
8.0.130.0030.00313.19
8.0.120.0050.00316.76
8.0.110.0050.00316.74
8.0.100.0040.00416.84
8.0.90.0000.00716.84
8.0.80.0000.01516.78
8.0.70.0030.00516.70
8.0.60.0040.00416.82
8.0.50.0040.00416.73
8.0.30.0120.01017.00
8.0.20.0080.01117.40
8.0.10.0080.00016.71
8.0.00.0070.00916.74
7.4.330.0000.00515.00
7.4.320.0050.00216.36
7.4.300.0000.00716.54
7.4.290.0000.00616.49
7.4.280.0000.00816.48
7.4.270.0050.00316.52
7.4.260.0030.00316.51
7.4.250.0000.00716.26
7.4.240.0040.00416.38
7.4.230.0070.00016.45
7.4.220.0070.01616.53
7.4.210.0120.00816.40
7.4.200.0000.00716.38
7.4.160.0050.01016.35
7.4.150.0110.00617.40
7.4.140.0100.00717.86
7.4.130.0100.00716.31
7.4.120.0030.01316.36
7.4.110.0140.00416.32
7.4.100.0100.00716.41
7.4.90.0120.00616.42
7.4.80.0110.01119.39
7.4.70.0110.00616.53
7.4.60.0060.01016.40
7.4.50.0060.00316.37
7.4.40.0100.00716.43
7.4.30.0040.01216.41
7.4.00.0020.01414.83
7.3.330.0000.00513.17
7.3.320.0060.00013.28
7.3.310.0000.00716.23
7.3.300.0000.00616.16
7.3.290.0090.00516.21
7.3.280.0080.00716.20
7.3.270.0090.00817.40
7.3.260.0110.00716.26
7.3.250.0080.01116.25
7.3.240.0110.00416.34
7.3.230.0070.01016.39
7.3.210.0080.00816.34
7.3.200.0130.00919.39
7.3.190.0090.00916.46
7.3.180.0100.00716.29
7.3.170.0100.00616.27
7.3.160.0060.00916.41
7.3.120.0060.01314.58
7.3.110.0040.01514.96
7.3.100.0030.01414.74
7.3.90.0030.01414.93
7.3.80.0130.00314.56
7.3.70.0030.00714.63
7.3.60.0090.00614.63
7.3.50.0060.00614.58
7.3.40.0150.00014.58
7.3.30.0100.00614.68
7.3.20.0100.00716.51
7.3.10.0070.00916.54
7.3.00.0060.00716.51
7.2.330.0110.00616.63
7.2.320.0070.01316.52
7.2.310.0120.00616.57
7.2.300.0100.00716.27
7.2.290.0030.01216.22
7.2.250.0140.00315.02
7.2.240.0100.01014.89
7.2.230.0070.01014.79
7.2.220.0030.01515.09
7.2.210.0110.00714.38
7.2.200.0030.01014.66
7.2.190.0090.00914.83
7.2.180.0030.00714.83
7.2.170.0000.01014.59
7.2.130.0070.00416.79
7.2.120.0060.00916.85
7.2.110.0070.00416.75
7.2.100.0090.00616.48
7.2.90.0110.00416.61
7.2.80.0070.00316.84
7.2.70.0100.00316.54
7.2.60.0060.00616.63
7.2.50.0030.01316.66
7.2.40.0030.01016.67
7.2.30.0040.01116.70
7.2.20.0000.00916.72
7.2.10.0060.00716.45
7.2.00.0090.00517.93
7.1.330.0120.00315.54
7.1.320.0000.01715.72
7.1.310.0140.00715.68
7.1.300.0110.00415.21
7.1.290.0000.01515.69
7.1.280.0000.01615.63
7.1.270.0070.00715.62
7.1.260.0090.00415.60
7.1.250.0060.00615.77
7.1.100.0000.01417.84
7.1.70.0000.01116.64
7.1.60.0130.00719.46
7.1.50.0100.00616.95
7.1.00.0000.07722.35
7.0.200.0040.00416.61
7.0.140.0030.07322.00
7.0.60.0100.06319.96
7.0.50.0030.08717.86
7.0.40.0170.08020.30
7.0.30.0530.07020.05
7.0.20.0400.07020.06
7.0.10.0130.04320.10
7.0.00.0130.08320.24
5.6.280.0000.07320.83
5.6.210.0000.04320.57
5.6.200.0030.04018.18
5.6.190.0100.07720.55
5.6.180.0200.04720.42
5.6.170.0200.04020.55
5.6.160.0100.07320.61
5.6.150.0100.07718.27
5.6.140.0000.09318.12
5.6.130.0070.08318.19
5.6.120.0030.04321.04
5.6.110.0100.08321.01
5.6.100.0130.07021.13
5.6.90.0130.03721.02
5.6.80.0170.06720.52
5.6.70.4470.04020.41
5.5.350.0130.08020.43
5.5.340.0100.06718.07
5.5.330.0070.05720.21
5.5.320.0200.05320.34
5.5.310.0270.06320.28
5.5.300.0130.07317.94
5.5.290.0000.04317.99
5.5.280.0070.06320.80
5.5.270.0070.08320.91
5.5.260.0030.06720.90
5.5.250.0170.07320.70
5.5.240.4070.04020.21
5.4.450.0230.04319.33
5.4.440.0370.03719.29
5.4.430.0270.03019.48
5.4.420.0230.04719.63
5.4.410.0200.03719.20
5.4.400.0230.04019.31
5.4.390.0200.04319.17
5.4.380.0270.06018.76
5.4.370.0330.04718.80
5.4.360.0770.07018.63
5.4.350.0700.05718.54
5.4.340.0230.05718.75
5.4.320.0080.03812.52
5.4.310.0090.03612.52
5.4.300.0070.03612.52
5.4.290.0070.03812.51
5.4.280.0050.03712.41
5.4.270.0080.03412.41
5.4.260.0060.03912.41
5.4.250.0050.04012.41
5.4.240.0040.04012.41
5.4.230.0100.05012.41
5.4.220.0060.04112.40
5.4.210.0090.03312.40
5.4.200.0070.04112.40
5.4.190.0050.03912.40
5.4.180.0050.03712.40
5.4.170.0050.04312.41
5.4.160.0060.03712.41
5.4.150.0050.04112.40
5.4.140.0080.04512.09
5.4.130.0080.03912.07
5.4.120.0050.03712.03
5.4.110.0060.03912.03
5.4.100.0070.03612.03
5.4.90.0090.03512.02
5.4.80.0110.03512.03
5.4.70.0070.03712.02
5.4.60.0060.03512.02
5.4.50.0060.03712.02
5.4.40.0080.03412.01
5.4.30.0070.03512.01
5.4.20.0040.03812.01
5.4.10.0150.03212.00
5.4.00.0070.04311.49
5.3.290.0090.03812.80
5.3.280.0080.03712.71
5.3.270.0110.05012.72
5.3.260.0060.04012.72
5.3.250.0050.03912.72
5.3.240.0070.04012.72
5.3.230.0070.04012.71
5.3.220.0060.03812.68
5.3.210.0070.04212.68
5.3.200.0080.04512.68
5.3.190.0060.04112.68
5.3.180.0090.04212.68
5.3.170.0070.03612.67
5.3.160.0040.03912.67
5.3.150.0030.04012.68
5.3.140.0050.03712.66
5.3.130.0090.03512.66
5.3.120.0050.04012.66
5.3.110.0110.03412.66
5.3.100.0110.03812.14
5.3.90.0100.03312.12
5.3.80.0050.03712.10
5.3.70.0060.03912.11
5.3.60.0090.04212.10
5.3.50.0090.03612.04
5.3.40.0060.04212.04
5.3.30.0040.03812.00
5.3.20.0080.03711.78
5.3.10.0080.04311.75
5.3.00.0090.03811.73
5.2.170.0050.0329.24
5.2.160.0080.0399.24
5.2.150.0080.0369.23
5.2.140.0070.0309.23
5.2.130.0060.0299.19
5.2.120.0090.0269.19
5.2.110.0070.0329.20
5.2.100.0040.0329.19
5.2.90.0030.0359.19
5.2.80.0030.0329.20
5.2.70.0020.0339.19
5.2.60.0060.0299.15
5.2.50.0030.0319.11
5.2.40.0100.0279.09
5.2.30.0050.0309.07
5.2.20.0020.0339.05
5.2.10.0060.0358.96
5.2.00.0060.0328.83
5.1.60.0040.0258.11
5.1.50.0060.0238.11
5.1.40.0070.0228.09
5.1.30.0070.0258.43
5.1.20.0070.0268.46
5.1.10.0020.0288.18
5.1.00.0060.0248.19
5.0.50.0020.0236.66
5.0.40.0030.0266.53
5.0.30.0010.0426.34
5.0.20.0030.0206.30
5.0.10.0070.0166.29
5.0.00.0030.0316.29
4.4.90.0020.0164.77
4.4.80.0060.0124.75
4.4.70.0040.0154.76
4.4.60.0040.0154.76
4.4.50.0040.0154.77
4.4.40.0030.0254.71
4.4.30.0040.0144.76
4.4.20.0050.0144.84
4.4.10.0010.0214.85
4.4.00.0050.0234.76
4.3.110.0030.0174.67
4.3.100.0040.0204.67
4.3.90.0030.0144.64
4.3.80.0040.0274.58
4.3.70.0040.0144.63
4.3.60.0040.0134.63
4.3.50.0030.0154.63
4.3.40.0010.0344.54
4.3.30.0020.0183.33
4.3.20.0020.0163.30
4.3.10.0030.0143.27
4.3.00.0100.01718.56

preferences:
43.84 ms | 401 KiB | 5 Q