3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xml_encode($mixed, $domElement=null, $DOMDocument=null) { if (is_null($DOMDocument)) { $DOMDocument =new DOMDocument; $DOMDocument->formatOutput = true; xml_encode($mixed, $DOMDocument, $DOMDocument); echo $DOMDocument->saveXML(); } else { if (is_array($mixed)) { foreach ($mixed as $index => $mixedElement) { if (is_int($index)) { if ($index === 0) { $node = $domElement; } else { $node = $DOMDocument->createElement($domElement->tagName); $domElement->parentNode->appendChild($node); } } else { $plural = $DOMDocument->createElement($index); $domElement->appendChild($plural); $node = $plural; if (!(rtrim($index, 's') === $index)) { $singular = $DOMDocument->createElement(rtrim($index, 's')); $plural->appendChild($singular); $node = $singular; } } xml_encode($mixedElement, $node, $DOMDocument); } } else { $mixed = is_bool($mixed) ? ($mixed ? 'true' : 'false') : $mixed; $domElement->appendChild($DOMDocument->createTextNode($mixed)); } } } $str = xml_encode( array ( 'res.wood' => 'Дерево', 'html.coins' => 'Монеты', 'html.community' => 'Сообщество', 'html.help' => 'Помощь', 'html.play' => 'Играть', 'res.water' => 'Вода', 'html.inv' => 'Пригласить<br>друзей', ) ); var_dump($str);

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.70.0040.01116.88
8.3.60.0190.00618.55
8.3.50.0180.00321.33
8.3.40.0090.00919.09
8.3.30.0100.00319.27
8.3.20.0080.00020.45
8.3.10.0040.00421.73
8.3.00.0080.00019.32
8.2.190.0100.00716.58
8.2.180.0070.01418.29
8.2.170.0170.00022.96
8.2.160.0090.00620.66
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00421.09
8.2.110.0030.00722.38
8.2.100.0030.01017.84
8.2.90.0040.00418.46
8.2.80.0000.00818.15
8.2.70.0000.00818.18
8.2.60.0060.00318.03
8.2.50.0090.00018.10
8.2.40.0030.00621.06
8.2.30.0090.00019.32
8.2.20.0000.00717.88
8.2.10.0050.00318.08
8.2.00.0000.00817.72
8.1.280.0070.00725.92
8.1.270.0080.00018.98
8.1.260.0030.00526.35
8.1.250.0050.00228.09
8.1.240.0030.00622.55
8.1.230.0040.00720.96
8.1.220.0040.00417.78
8.1.210.0080.00019.16
8.1.200.0030.00617.47
8.1.190.0040.00417.38
8.1.180.0050.00318.10
8.1.170.0070.00318.71
8.1.160.0070.00020.32
8.1.150.0040.00418.99
8.1.140.0040.00417.54
8.1.130.0040.00418.06
8.1.120.0000.00717.54
8.1.110.0030.00517.58
8.1.100.0020.00517.68
8.1.90.0050.00317.61
8.1.80.0040.00417.59
8.1.70.0000.00917.58
8.1.60.0060.00317.71
8.1.50.0050.00317.73
8.1.40.0030.00617.61
8.1.30.0000.00917.74
8.1.20.0050.00217.75
8.1.10.0040.00417.72
8.1.00.0040.00417.57
8.0.300.0040.00420.05
8.0.290.0000.00816.88
8.0.280.0040.00418.67
8.0.270.0070.00017.30
8.0.260.0060.00017.43
8.0.250.0000.00817.03
8.0.240.0040.00417.03
8.0.230.0030.00317.17
8.0.220.0000.00716.98
8.0.210.0040.00417.04
8.0.200.0000.00717.11
8.0.190.0080.00017.08
8.0.180.0030.00617.09
8.0.170.0040.00417.00
8.0.160.0000.00717.05
8.0.150.0080.00016.97
8.0.140.0050.00316.91
8.0.130.0020.00413.55
8.0.120.0060.00316.98
8.0.110.0050.00216.91
8.0.100.0000.00817.20
8.0.90.0000.00716.95
8.0.80.0060.00916.94
8.0.70.0000.00717.06
8.0.60.0070.00016.87
8.0.50.0000.00817.00
8.0.30.0150.00717.30
8.0.20.0110.01117.43
8.0.10.0070.00017.08
8.0.00.0110.00716.84
7.4.330.0000.00515.30
7.4.320.0000.00716.64
7.4.300.0030.00316.76
7.4.290.0000.00716.68
7.4.280.0000.00816.63
7.4.270.0000.00716.72
7.4.260.0070.00016.85
7.4.250.0060.00316.69
7.4.240.0020.00516.75
7.4.230.0040.00416.86
7.4.220.0130.01316.75
7.4.210.0100.00716.55
7.4.200.0070.00016.79
7.4.160.0030.01916.72
7.4.150.0090.00917.40
7.4.140.0120.00717.86
7.4.130.0070.01016.68
7.4.120.0030.01416.74
7.4.110.0170.00916.61
7.4.100.0100.00716.64
7.4.90.0120.00616.70
7.4.80.0110.00719.39
7.4.70.0130.00316.86
7.4.60.0070.01016.79
7.4.50.0050.00316.81
7.4.40.0100.00716.48
7.4.30.0070.01016.75
7.4.00.0070.00715.10
7.3.330.0030.00313.56
7.3.320.0060.00013.55
7.3.310.0000.00716.44
7.3.300.0030.00316.43
7.3.290.0030.00316.59
7.3.280.0080.00916.54
7.3.270.0110.00717.40
7.3.260.0130.00716.57
7.3.250.0110.01316.61
7.3.240.0160.00816.70
7.3.230.0030.01616.80
7.3.210.0060.01216.52
7.3.200.0100.00719.39
7.3.190.0060.01016.79
7.3.180.0060.01616.82
7.3.170.0090.01216.59
7.3.160.0190.00016.71
7.3.120.0120.00615.18
7.3.110.0130.00614.73
7.3.100.0060.01315.21
7.3.90.0120.00014.71
7.3.80.0120.00314.92
7.3.70.0040.00714.83
7.3.60.0100.00715.00
7.3.50.0030.01015.04
7.3.40.0040.00814.95
7.3.30.0030.01314.98
7.3.20.0030.01616.95
7.3.10.0020.01316.78
7.3.00.0060.01016.53
7.2.330.0110.00616.98
7.2.320.0000.01616.82
7.2.310.0140.00816.53
7.2.300.0100.01016.62
7.2.290.0140.00916.63
7.2.250.0000.01915.18
7.2.240.0060.01315.14
7.2.230.0060.00915.51
7.2.220.0030.01215.12
7.2.210.0110.00415.08
7.2.200.0030.00615.00
7.2.190.0090.00615.29
7.2.180.0090.00615.28
7.2.170.0000.00915.25
7.2.160.0090.00614.99
7.2.150.0060.01316.67
7.2.140.0070.01017.25
7.2.130.0140.00316.82
7.2.120.0040.00917.01
7.2.110.0030.00716.80
7.2.100.0050.01117.03
7.2.90.0050.01016.91
7.2.80.0040.00716.93
7.2.70.0000.01317.10
7.2.60.0060.00717.08
7.2.50.0020.01417.16
7.2.40.0030.01317.01
7.2.30.0030.01217.00
7.2.20.0070.00716.84
7.2.10.0070.00716.97
7.2.00.0090.00516.93
7.1.330.0070.00716.11
7.1.320.0130.00315.75
7.1.310.0030.01015.91
7.1.300.0030.01415.97
7.1.290.0130.00015.87
7.1.280.0040.01115.63
7.1.270.0150.00315.86
7.1.260.0070.01115.75
7.1.250.0070.00315.94
7.1.240.0080.00815.70
7.1.230.0030.00715.77
7.1.220.0000.01515.91
7.1.210.0080.00315.86
7.1.200.0090.00515.84
7.1.190.0120.00315.62
7.1.180.0070.00715.89
7.1.170.0040.00815.95
7.1.160.0120.00816.00
7.1.150.0040.01116.02
7.1.140.0040.01116.00
7.1.130.0070.00315.82
7.1.120.0090.00616.06
7.1.110.0060.00615.95
7.1.100.0020.01017.04
7.1.90.0090.00615.99
7.1.80.0000.01115.66
7.1.70.0060.00416.59
7.1.60.0050.01217.52
7.1.50.0080.00616.50
7.1.40.0000.01115.86
7.1.30.0030.01015.93
7.1.20.0000.01416.00
7.1.10.0100.00316.10
7.1.00.0030.04319.11
7.0.330.0070.00715.44
7.0.320.0060.00515.48
7.0.310.0100.00315.53
7.0.300.0090.00615.46
7.0.290.0070.01115.44
7.0.280.0100.00315.63
7.0.270.0060.00915.49
7.0.260.0040.01215.26
7.0.250.0030.00915.34
7.0.240.0040.01115.51
7.0.230.0070.00715.55
7.0.220.0030.00915.39
7.0.210.0060.00615.45
7.0.200.0060.00516.09
7.0.190.0040.01115.65
7.0.180.0090.00615.59
7.0.170.0000.01115.51
7.0.160.0000.01115.47
7.0.150.0060.00915.47
7.0.140.0050.03918.87
7.0.130.0070.00715.59
7.0.120.0080.00315.63
7.0.110.0070.01015.61
7.0.100.0070.01015.41
7.0.90.0090.00015.59
7.0.80.0030.00915.38
7.0.70.0040.00815.51
7.0.60.0050.02517.81
7.0.50.0070.04216.77
7.0.40.0120.03316.90
7.0.30.0150.02516.77
7.0.20.0170.03316.92
7.0.10.0020.03217.01
7.0.00.0020.04416.97
5.6.400.0030.01314.50
5.6.390.0110.00014.45
5.6.380.0050.00514.46
5.6.370.0070.00714.61
5.6.360.0040.01514.58
5.6.350.0100.00014.77
5.6.340.0070.00314.26
5.6.330.0030.01314.37
5.6.320.0000.01614.25
5.6.310.0030.00714.46
5.6.300.0030.01514.61
5.6.290.0090.00614.53
5.6.280.0050.04018.03
5.6.270.0000.00914.50
5.6.260.0030.01314.48
5.6.250.0090.00614.53
5.6.240.0000.00914.35
5.6.230.0070.00714.65
5.6.220.0070.01014.69
5.6.210.0080.03517.54
5.6.200.0080.04316.39
5.6.190.0060.04517.59
5.6.180.0230.03817.55
5.6.170.0130.03117.62
5.6.160.0070.04517.58
5.6.150.0110.03916.33
5.6.140.0090.02916.51
5.6.130.0030.02716.30
5.6.120.0070.04017.76
5.6.110.0030.02517.72
5.6.100.0100.04217.83
5.6.90.0080.03217.92
5.6.80.0070.03917.56
5.6.70.0000.01614.38
5.6.60.0060.00614.64
5.6.50.0000.01414.10
5.6.40.0060.01014.20
5.6.30.0040.01114.33
5.6.20.0060.01214.24
5.6.10.0060.00614.35
5.6.00.0080.00314.46
5.5.380.0060.00614.39
5.5.370.0040.00414.17
5.5.360.0070.00714.65
5.5.350.0120.04317.53
5.5.340.0070.04516.43
5.5.330.0080.04617.17
5.5.320.0230.02617.45
5.5.310.0180.04117.31
5.5.300.0040.02316.18
5.5.290.0070.03016.15
5.5.280.0080.03317.66
5.5.270.0080.04317.70
5.5.260.0100.04417.61
5.5.250.0070.04417.34
5.5.240.0020.02717.32
5.5.230.0030.00614.11
5.5.220.0030.01314.34
5.5.210.0000.01114.55
5.5.200.0060.00614.31
5.5.190.0130.00014.06
5.5.180.0030.01014.37
5.5.170.0120.00014.34
5.5.160.0070.00714.48
5.5.150.0140.00014.52
5.5.140.0060.00614.12
5.5.130.0000.01614.15
5.5.120.0030.01414.32
5.5.110.0090.00314.29
5.5.100.0070.01014.09
5.5.90.0120.00314.27
5.5.80.0030.01014.10
5.5.70.0070.00714.37
5.5.60.0090.00614.32
5.5.50.0100.00714.57
5.5.40.0040.00814.47
5.5.30.0040.00814.50
5.5.20.0090.00614.38
5.5.10.0060.00914.19
5.5.00.0080.00414.01
5.4.450.0390.03715.45
5.4.440.0100.03015.33
5.4.430.0100.02815.35
5.4.420.0020.03415.33
5.4.410.0130.03015.40
5.4.400.0080.03215.43
5.4.390.0130.02615.29
5.4.380.0100.04315.01
5.4.370.0100.03015.05
5.4.360.0170.03715.08
5.4.350.0130.03815.09
5.4.340.0100.03015.01
5.4.330.0040.00811.20
5.4.320.0120.02615.17
5.4.310.0050.03414.89
5.4.300.0080.03514.91
5.4.290.0130.02714.96
5.4.280.0120.04115.03
5.4.270.0080.04414.87
5.4.260.0130.03415.01
5.4.250.0120.03114.93
5.4.240.0120.02714.97
5.4.230.0100.03014.94
5.4.220.0090.03115.02
5.4.210.0120.02714.87
5.4.200.0080.03213.92
5.4.190.0150.02214.93
5.4.180.0120.03015.01
5.4.170.0160.02615.07
5.4.160.0100.03015.01
5.4.150.0130.03015.06
5.4.140.0100.02713.87
5.4.130.0170.02313.87
5.4.120.0080.03313.82
5.4.110.0080.03013.79
5.4.100.0080.04213.87
5.4.90.0140.02613.83
5.4.80.0080.03113.92
5.4.70.0110.03213.77
5.4.60.0130.02213.77
5.4.50.0130.02913.81
5.4.40.0120.03613.82
5.4.30.0080.03013.88
5.4.20.0070.03613.87
5.4.10.0140.02413.77
5.4.00.0090.02913.51
5.3.290.0200.05314.87
5.3.280.0370.05014.72
5.3.270.0230.04714.69
5.3.260.0170.07714.89
5.3.250.0170.05714.87
5.3.240.0200.06714.78
5.3.230.0130.05314.73
5.3.220.0200.04714.73
5.3.210.0270.04714.83
5.3.200.0230.04014.83
5.3.190.0100.05714.86
5.3.180.0170.05714.75
5.3.170.0170.07014.71
5.3.160.0130.06714.85
5.3.150.0000.06714.76
5.3.140.0130.05314.84
5.3.130.0230.06714.55
5.3.120.0200.06014.82
5.3.110.0170.05314.61
5.3.100.0270.05314.30
5.3.90.0200.06314.27
5.3.80.0170.06714.27
5.3.70.0070.05714.16
5.3.60.0030.06014.19
5.3.50.0200.04314.16
5.3.40.0070.06314.03
5.3.30.0200.04714.28
5.3.20.0270.05314.06
5.3.10.0230.05713.91
5.3.00.0130.07013.74
5.2.170.0030.04711.23
5.2.160.0130.04011.43
5.2.150.0070.04711.35
5.2.140.0170.05311.51
5.2.130.0230.04711.32
5.2.120.0130.05311.29
5.2.110.0170.04711.20
5.2.100.0100.05011.47
5.2.90.0030.06311.18
5.2.80.0200.03311.18
5.2.70.0170.03711.30
5.2.60.0100.04311.42
5.2.50.0030.05011.30
5.2.40.0030.04711.10
5.2.30.0030.06011.05
5.2.20.0170.04711.21
5.2.10.0170.04710.94
5.2.00.0100.04310.97
5.1.60.0100.03310.06
5.1.50.0170.04310.00
5.1.40.0130.04310.18
5.1.30.0130.03710.59
5.1.20.0130.03710.61
5.1.10.0070.04010.29
5.1.00.0170.03010.16
5.0.50.0100.0278.63
5.0.40.0030.0308.54
5.0.30.0100.0438.45
5.0.20.0100.0338.43
5.0.10.0130.0308.41
5.0.00.0100.0438.29
4.4.90.0100.0175.93
4.4.80.0000.0275.90
4.4.70.0030.0235.93
4.4.60.0000.0335.77
4.4.50.0000.0275.96
4.4.40.0070.0336.04
4.4.30.0130.0175.90
4.4.20.0130.0235.97
4.4.10.0000.0276.00
4.4.00.0130.0375.94
4.3.110.0030.0335.84
4.3.100.0070.0275.88
4.3.90.0030.0305.83
4.3.80.0000.0405.82
4.3.70.0070.0205.86
4.3.60.0130.0235.89
4.3.50.0070.0235.82
4.3.40.0030.0375.77
4.3.30.0100.0175.02
4.3.20.0070.0275.02
4.3.10.0130.0105.02
4.3.00.0100.0207.60

preferences:
78.28 ms | 401 KiB | 5 Q