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 ( 'cry_shop' => array ( 'packs' => array ( 3 => array ( 'id' => 3, 'minLevel' => 1, 'elements' => array ( 'crystal' => array ( 'count' => 100, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => 'inap1', 'priceCraft' => array ( ), 'priceCrystal' => NULL, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), 'gold_shop' => array ( 'packs' => array ( 2 => array ( 'id' => 2, 'minLevel' => 1, 'elements' => array ( 'gold' => array ( 'count' => 500, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => 'inap1', 'priceCraft' => array ( ), 'priceCrystal' => NULL, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), 'res_shop' => array ( 'packs' => array ( 1 => array ( 'id' => 1, 'minLevel' => 1, 'elements' => array ( 'wood' => array ( 'count' => 30, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), 'stone' => array ( 'count' => 50, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => NULL, 'priceCraft' => array ( ), 'priceCrystal' => NULL, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), 'util_shop' => array ( 'packs' => array ( 4 => array ( 'id' => 4, 'minLevel' => 0, 'elements' => array ( 'dropRequestCounter' => array ( 'count' => 1, 'offer' => NULL, 'probability' => NULL, 'offerVal' => NULL, 'offerStartTime' => NULL, 'offerEndTime' => NULL, ), ), 'inapSystemName' => NULL, 'priceCraft' => array ( ), 'priceCrystal' => 5, 'crystalOffer' => NULL, 'crystalOfferVal' => NULL, 'crystalOfferStartTime' => NULL, 'crystalOfferEndTime' => NULL, 'translationTitle' => NULL, 'translationDescription' => NULL, ), ), 'translationTitle' => NULL, 'translationDescription' => NULL, ), ) ); 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.60.0110.00718.93
8.3.50.0140.00316.61
8.3.40.0090.00618.90
8.3.30.0150.00019.16
8.3.20.0040.00420.38
8.3.10.0040.00422.02
8.3.00.0080.00019.28
8.2.180.0130.00618.54
8.2.170.0120.00622.96
8.2.160.0140.00020.77
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00821.50
8.2.110.0060.00321.25
8.2.100.0080.00418.16
8.2.90.0090.00018.59
8.2.80.0000.00818.28
8.2.70.0050.00318.14
8.2.60.0060.00618.22
8.2.50.0000.00918.10
8.2.40.0040.00421.41
8.2.30.0000.00819.42
8.2.20.0080.00018.05
8.2.10.0040.00418.14
8.2.00.0000.00817.83
8.1.270.0050.00519.08
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0100.00317.64
8.1.230.0040.00821.27
8.1.220.0030.00618.04
8.1.210.0040.00419.21
8.1.200.0150.00017.37
8.1.190.0080.00017.48
8.1.180.0050.00318.10
8.1.170.0090.00018.84
8.1.160.0080.00020.56
8.1.150.0030.00619.17
8.1.140.0080.00017.73
8.1.130.0000.00718.07
8.1.120.0070.00017.66
8.1.110.0080.00017.72
8.1.100.0000.00717.68
8.1.90.0000.00717.67
8.1.80.0040.00417.61
8.1.70.0000.00817.57
8.1.60.0030.00717.77
8.1.50.0000.00917.72
8.1.40.0030.00517.70
8.1.30.0000.00817.85
8.1.20.0090.00017.85
8.1.10.0050.00517.70
8.1.00.0040.00417.68
8.0.300.0090.00019.86
8.0.290.0080.00016.72
8.0.280.0040.00418.70
8.0.270.0050.00317.37
8.0.260.0030.00317.37
8.0.250.0070.00317.09
8.0.240.0040.00417.24
8.0.230.0030.00317.12
8.0.220.0000.00717.02
8.0.210.0030.00317.04
8.0.200.0070.00017.06
8.0.190.0060.00317.12
8.0.180.0000.00817.19
8.0.170.0030.00517.13
8.0.160.0030.00517.17
8.0.150.0080.00016.98
8.0.140.0000.00717.00
8.0.130.0000.00613.55
8.0.120.0070.00316.95
8.0.110.0000.00817.09
8.0.100.0080.00017.18
8.0.90.0030.00516.92
8.0.80.0120.00417.21
8.0.70.0020.00517.21
8.0.60.0060.00317.17
8.0.50.0000.00716.91
8.0.30.0120.00717.20
8.0.20.0100.01217.40
8.0.10.0000.00817.31
8.0.00.0090.00817.01
7.4.330.0000.00515.13
7.4.320.0030.00516.69
7.4.300.0030.00316.66
7.4.290.0000.00716.72
7.4.280.0040.00416.73
7.4.270.0000.00816.71
7.4.260.0030.00616.77
7.4.250.0040.00416.69
7.4.240.0020.00616.82
7.4.230.0000.00716.94
7.4.220.0060.01216.75
7.4.210.0060.00916.57
7.4.200.0040.00416.89
7.4.160.0070.01016.54
7.4.150.0160.01017.40
7.4.140.0100.00917.86
7.4.130.0080.01016.75
7.4.120.0110.01016.62
7.4.110.0070.01016.59
7.4.100.0200.00316.82
7.4.90.0060.01216.53
7.4.80.0070.01019.39
7.4.70.0100.00716.59
7.4.60.0100.00716.88
7.4.50.0030.00616.90
7.4.40.0100.00716.42
7.4.30.0060.01316.64
7.4.00.0040.01115.04
7.3.330.0000.00813.58
7.3.320.0030.00313.43
7.3.310.0070.00016.45
7.3.300.0000.00716.50
7.3.290.0110.00416.59
7.3.280.0080.01316.57
7.3.270.0150.00917.40
7.3.260.0150.00416.88
7.3.250.0040.01416.84
7.3.240.0180.00616.63
7.3.230.0030.01316.73
7.3.210.0100.00716.56
7.3.200.0160.00619.39
7.3.190.0070.01316.60
7.3.180.0140.00316.73
7.3.170.0090.00816.50
7.3.160.0180.00016.82
7.3.10.0040.01516.78
7.3.00.0110.00816.91
7.2.330.0090.01217.09
7.2.320.0030.01517.02
7.2.310.0100.00616.83
7.2.300.0070.01316.95
7.2.290.0150.00916.73
7.2.130.0070.00717.21
7.2.120.0080.00417.09
7.2.110.0030.00717.07
7.2.100.0070.00716.78
7.2.90.0040.01516.98
7.2.80.0090.00617.20
7.2.70.0030.01317.14
7.2.60.0070.00816.89
7.2.50.0060.00617.02
7.2.40.0060.01317.26
7.2.30.0060.00916.93
7.2.20.0030.01016.97
7.2.10.0040.01116.85
7.2.00.0050.01018.47
7.1.250.0100.00315.84
7.1.200.0030.01015.68
7.1.100.0070.00717.82
7.1.70.0000.00917.43
7.1.60.0100.01419.22
7.1.50.0100.01034.98
7.1.00.0030.07722.37
7.0.200.0030.00716.76
7.0.140.0030.06722.21
7.0.60.0270.07020.04
7.0.50.0070.04018.05
7.0.40.0130.08020.23
7.0.30.0270.05720.34
7.0.20.0370.07020.32
7.0.10.0100.04320.30
7.0.00.0200.06020.24
5.6.280.0030.07721.02
5.6.210.0170.06320.69
5.6.200.0130.06318.29
5.6.190.0100.08020.43
5.6.180.0300.05720.61
5.6.170.0400.08020.57
5.6.160.0030.08020.62
5.6.150.0000.09018.29
5.6.140.0070.05318.33
5.6.130.0070.08318.38
5.6.120.0170.03721.27
5.6.110.0170.07321.14
5.6.100.0130.07321.14
5.6.90.0030.09321.15
5.6.80.0070.03720.66
5.5.350.0270.07320.51
5.5.340.0070.07318.14
5.5.330.0030.08020.54
5.5.320.0300.05020.53
5.5.310.0230.08020.34
5.5.300.0100.07318.08
5.5.290.0000.08718.18
5.5.280.0030.05320.91
5.5.270.0130.08021.01
5.5.260.0070.04320.89
5.5.250.0100.08720.94
5.5.240.0200.07320.31
5.4.450.0500.06319.57
5.4.440.0230.04719.31
5.4.430.0170.05719.39
5.4.420.0170.05719.48
5.4.410.0100.06319.52
5.4.400.0170.05019.30
5.4.390.0170.05319.45
5.4.380.0130.05718.68
5.4.370.0100.06318.84
5.4.360.0070.06719.02
5.4.350.0070.06718.88
5.4.340.0200.05018.75
5.4.320.0170.05718.65
5.4.310.0200.05018.68
5.4.300.0100.06018.78
5.4.290.0170.05718.90
5.4.280.0100.05718.95
5.4.270.0100.06018.88
5.4.260.0230.04318.87
5.4.250.0270.06018.62
5.4.240.0170.05018.77
5.4.230.0270.05318.70
5.4.220.0100.06018.67
5.4.210.0130.06018.89
5.4.200.0170.05016.77
5.4.190.0170.06018.69
5.4.180.0170.05318.93
5.4.170.0200.05018.72
5.4.160.0270.04018.83
5.4.150.0070.06718.64
5.4.140.0170.05016.34
5.4.130.0100.05016.57
5.4.120.0030.05716.48
5.4.110.0100.05016.44
5.4.100.0170.05016.32
5.4.90.0230.04316.43
5.4.80.0170.04716.43
5.4.70.0070.06016.41
5.4.60.0100.05316.34
5.4.50.0170.04716.53
5.4.40.0100.05316.29
5.4.30.0070.05716.28
5.4.20.0030.06316.40
5.4.10.0100.05316.52
5.4.00.0170.04716.01
5.3.290.0130.05715.01
5.3.280.0070.05714.72
5.3.270.0100.05714.89
5.3.260.0170.05014.94
5.3.250.0230.04014.75
5.3.240.0070.06014.98
5.3.230.0130.05314.83
5.3.220.0100.05714.75
5.3.210.0130.05714.90
5.3.200.0270.04014.73
5.3.190.0130.05314.89
5.3.180.0170.05014.73
5.3.170.0170.05014.91
5.3.160.0130.05714.89
5.3.150.0100.05714.70
5.3.140.0130.05314.87
5.3.130.0100.05714.89
5.3.120.0030.06314.75
5.3.110.0030.06314.72
5.3.100.0100.06714.19
5.3.90.0100.05714.34
5.3.80.0100.05314.29
5.3.70.0030.06014.29
5.3.60.0130.05014.31
5.3.50.0100.05314.11
5.3.40.0170.06014.27
5.3.30.0170.05314.22
5.3.20.0130.04714.01
5.3.10.0170.04713.97
5.3.00.0170.04713.80
5.2.170.0130.04311.46
5.2.160.0130.03711.42
5.2.150.0000.05011.30
5.2.140.0100.04011.46
5.2.130.0130.03711.47
5.2.120.0130.03711.42
5.2.110.0100.04311.34
5.2.100.0100.04011.27
5.2.90.0130.04311.43
5.2.80.0100.04311.42
5.2.70.0130.04011.35
5.2.60.0070.04311.33
5.2.50.0030.05011.28
5.2.40.0070.04311.19
5.2.30.0100.04311.12
5.2.20.0100.04011.25
5.2.10.0070.04311.23
5.2.00.0070.04311.18
5.1.60.0130.03010.38
5.1.50.0100.03310.41
5.1.40.0130.03010.16
5.1.30.0030.04310.68
5.1.20.0030.04310.70
5.1.10.0070.03710.34
5.1.00.0100.03310.25
5.0.50.0070.0278.88
5.0.40.0030.0308.65
5.0.30.0070.0438.50
5.0.20.0030.0308.38
5.0.10.0000.0338.41
5.0.00.0100.0408.39
4.4.90.0030.0235.98
4.4.80.0070.0206.08
4.4.70.0100.0175.95
4.4.60.0100.0176.06
4.4.50.0070.0206.01
4.4.40.0070.0336.06
4.4.30.0070.0205.99
4.4.20.0070.0206.16
4.4.10.0030.0306.11
4.4.00.0030.0376.00
4.3.110.0030.0275.87
4.3.100.0030.0235.96
4.3.90.0000.0235.88
4.3.80.0070.0305.98
4.3.70.0030.0235.88
4.3.60.0100.0175.85
4.3.50.0030.0235.85
4.3.40.0000.0375.86
4.3.30.0000.0275.22
4.3.20.0000.0275.22
4.3.10.0000.0275.22
4.3.00.0100.0307.03

preferences:
65.12 ms | 400 KiB | 5 Q