3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_to_xml(array $data) { $document = new DOMDocument(); array_to_xml_aux($data, $document); $document->formatOutput = true; return $document; } function array_to_xml_aux(array $data, DOMNode $parent, $name = null) { foreach ($data as $key => $value) { if ($key[0] == '@') { $parent->setAttribute( substr($key, 1), $value ); return; } if (is_numeric($key)) { $key = $name; } if (is_array($value)) { $subnode = new DOMElement($key); $parent->appendChild($subnode); array_to_xml_aux($value, $subnode, $key); } else { $xml_data->appendChild(new DOMElement($key, $value)); } } } $document = array_to_xml( array( 'Products' => array( 'Product' => array('@name' => 'TR-501'), 'Descricao' => array('@text' => '55.180.198 / 46789771'), 'opcionais' => array( 'opcional' => array( 'oi' ) ), ) ) ); echo $document->saveXML();

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.0130.00718.30
8.3.50.0110.00718.10
8.3.40.0120.00318.79
8.3.30.0090.00918.67
8.3.20.0040.01119.21
8.3.10.0000.00821.90
8.3.00.0000.00820.66
8.2.180.0040.01418.28
8.2.170.0080.00822.96
8.2.160.0110.00422.19
8.2.150.0080.00024.18
8.2.140.0070.00324.66
8.2.130.0080.00019.77
8.2.120.0040.00426.35
8.2.110.0070.01020.51
8.2.100.0110.00017.97
8.2.90.0040.00417.75
8.2.80.0090.00017.97
8.2.70.0040.00417.93
8.2.60.0040.00418.34
8.2.50.0050.00518.10
8.2.40.0030.00519.53
8.2.30.0070.00019.45
8.2.20.0020.00518.26
8.2.10.0070.00018.13
8.2.00.0000.00817.67
8.1.280.0160.00025.92
8.1.270.0000.00819.01
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00423.98
8.1.230.0070.00419.09
8.1.220.0030.00617.91
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0040.00817.23
8.1.180.0040.00418.10
8.1.170.0060.00318.55
8.1.160.0000.00818.90
8.1.150.0050.00318.98
8.1.140.0040.00422.15
8.1.130.0070.00020.29
8.1.120.0000.00717.50
8.1.110.0040.00417.54
8.1.100.0000.00817.46
8.1.90.0000.00717.58
8.1.80.0000.00717.45
8.1.70.0060.00317.44
8.1.60.0030.00617.63
8.1.50.0030.00617.57
8.1.40.0000.00917.51
8.1.30.0070.00317.64
8.1.20.0040.00417.58
8.1.10.0040.00417.69
8.1.00.0050.00317.53
8.0.300.0020.00519.76
8.0.290.0000.00816.75
8.0.280.0030.00318.51
8.0.270.0000.00717.25
8.0.260.0000.00718.59
8.0.250.0050.00217.09
8.0.240.0000.00817.10
8.0.230.0000.00717.07
8.0.220.0040.00416.97
8.0.210.0000.00716.93
8.0.200.0000.00717.04
8.0.190.0040.00416.99
8.0.180.0050.00316.92
8.0.170.0030.00617.04
8.0.160.0070.00017.06
8.0.150.0030.00516.85
8.0.140.0040.00416.89
8.0.130.0060.00013.46
8.0.120.0030.00517.00
8.0.110.0040.00416.93
8.0.100.0000.00817.02
8.0.90.0000.00716.97
8.0.80.0050.01216.94
8.0.70.0000.00717.02
8.0.60.0000.00817.11
8.0.50.0070.00016.87
8.0.30.0100.01017.10
8.0.20.0130.00617.40
8.0.10.0070.00017.02
8.0.00.0130.00816.79
7.4.330.0000.00515.55
7.4.320.0000.00716.63
7.4.300.0030.00316.67
7.4.290.0000.00716.43
7.4.280.0070.00016.70
7.4.270.0050.00216.50
7.4.260.0030.00716.56
7.4.250.0080.00016.57
7.4.240.0000.00716.59
7.4.230.0000.00716.78
7.4.220.0050.00316.33
7.4.210.0140.00316.69
7.4.200.0000.00716.58
7.4.160.0090.00816.66
7.4.140.0080.01017.86
7.4.130.0090.01016.57
7.4.120.0080.00916.58
7.4.110.0090.00916.50
7.4.100.0140.00616.45
7.4.90.0110.00616.73
7.4.80.0060.01219.39
7.4.70.0100.00616.66
7.4.60.0100.00716.73
7.4.50.0060.00916.72
7.4.40.0090.00916.48
7.4.00.0070.00714.93
7.3.330.0060.00013.50
7.3.320.0060.00013.43
7.3.310.0080.00016.53
7.3.300.0000.00716.45
7.3.290.0050.00216.38
7.3.280.0110.00816.44
7.3.260.0110.00816.60
7.3.240.0090.01016.55
7.3.230.0000.01816.57
7.3.210.0130.00316.71
7.3.200.0130.00316.34
7.3.190.0070.01016.55
7.3.180.0100.00716.50
7.3.170.0080.01216.58
7.3.160.0170.00316.60
7.2.330.0090.00916.77
7.2.320.0090.01016.84
7.2.310.0130.01016.82
7.2.300.0130.00316.75
7.2.290.0030.01616.81
7.2.110.0670.01314.80
7.2.100.0610.01414.71
7.2.90.0960.01014.70
7.2.80.0960.00614.36
7.2.70.0800.00314.92
7.2.60.0530.00615.13
7.2.50.0980.00615.03
7.2.40.0670.01314.84
7.2.30.0940.01014.79
7.2.20.0750.01314.86
7.2.10.0850.00714.82
7.2.00.1420.00615.02
7.1.230.0560.00013.93
7.1.220.1240.00013.83
7.1.210.0620.00314.04
7.1.200.0910.01013.73
7.1.190.0690.00913.68
7.1.180.0820.00614.09
7.1.170.0670.00913.54
7.1.160.0990.01013.81
7.1.150.0760.00313.40
7.1.140.0720.00313.74
7.1.130.0810.00713.79
7.1.120.0980.01313.76
7.1.110.0630.00613.66
7.1.100.0860.00313.51
7.1.90.0880.00613.91
7.1.80.1060.00913.91
7.1.70.1090.00313.87
7.1.60.1010.01031.45
7.1.50.1180.00931.72
7.1.40.1580.00831.71
7.1.30.1830.00331.57
7.1.20.1140.01631.73
7.1.10.0920.01013.92
7.1.00.0280.02113.66
5.6.380.0100.01014.51

preferences:
50.97 ms | 400 KiB | 5 Q