3v4l.org

run code in 300+ PHP versions simultaneously
<?php $context = [ 'mes' => [ 'attributes' => [ 't' => 'AddEvent', 'id' => 'test_id', ], 'ev' => [ 'attributes' => [ 'evt' => 'packet20130828ki3si0', 'src' => 'NVV', 'st' => 'test', 'start' => '12423511247', 'stop' => '12423991978', 'addrtype' => 'MB', 'clntID' => '+380957700418', 'lg' => '', 'bank' => '', 'lang' => '', 'prior' => '', 'brnm' => '', 'extref' => '', 'intref' => '', 'extaddrtype' => '', 'extaddrid' => '', 'recall' => '', ], 'attr' => [ [ 'attributes' => [ 'code' => '1', 'val' => '11', ], ], [ 'attributes' => [ 'code' => '2', 'val' => '12', ], ], ], 'hist' => [ [ 'attributes' => [ 'st' => '', 'ch' => '', 'lg' => '', 'con' => '', 'com' => '', 'addrtype' => '', 'addrid' => '', 'dt' => '', 'contactId' => '', ], ], ], ], ], ]; class Conv { protected $res; protected $context; public function __construct(array $context) { if (count($context) != 1) { throw new Exception('Must be only one root element', 500); } $this->context = $context; $this->init(key($this->context)); } public function conv() { return $this->a2x(current($this->context), $this->res)->asXML(); } protected function init($root) { $this->res = new SimpleXMLElement("<{$root}/>"); } protected function a2x(array $inner, SimpleXMLElement $node) { foreach ($inner as $key => $value) { if ($key == 'attributes') { if (count($value)) { foreach ($value as $attrKey => $attrVal) { //var_dump($attrKey, $attrVal);exit; $node->addAttribute($attrKey, is_string($attrVal)?$attrVal:'test'); } } } else { $subNode = $node->addChild($key); $this->a2x($value, $subNode); } } return $this->res; } } $a2x = new Conv($context); var_dump($a2x->conv()); //->asXML();

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.0060.01317.00
8.3.60.0140.00017.13
8.3.50.0080.00718.53
8.3.40.0060.01319.22
8.3.30.0060.00919.04
8.3.20.0030.00619.16
8.3.10.0060.00320.65
8.3.00.0030.00619.63
8.2.180.0110.00625.92
8.2.170.0080.00819.16
8.2.160.0070.00722.96
8.2.150.0120.00325.66
8.2.140.0030.00524.66
8.2.130.0160.00326.16
8.2.120.0040.00419.09
8.2.110.0060.00321.28
8.2.100.0090.00318.03
8.2.90.0050.00519.73
8.2.80.0030.00519.65
8.2.70.0030.00617.88
8.2.60.0040.00418.18
8.2.50.0060.00318.07
8.2.40.0040.00418.42
8.2.30.0060.00318.33
8.2.20.0080.00017.91
8.2.10.0000.00818.02
8.2.00.0040.00417.96
8.1.280.0110.00425.92
8.1.270.0070.00723.99
8.1.260.0000.01126.35
8.1.250.0080.00028.09
8.1.240.0070.00322.67
8.1.230.0060.00621.22
8.1.220.0060.00317.91
8.1.210.0070.00319.15
8.1.200.0030.00717.60
8.1.190.0000.00817.89
8.1.180.0030.00618.10
8.1.170.0000.00820.88
8.1.160.0040.00419.16
8.1.150.0000.00718.93
8.1.140.0020.00517.68
8.1.130.0070.00018.16
8.1.120.0000.00817.69
8.1.110.0000.00717.64
8.1.100.0000.00717.76
8.1.90.0040.00417.59
8.1.80.0000.00717.71
8.1.70.0030.00317.65
8.1.60.0000.00817.89
8.1.50.0030.00517.74
8.1.40.0060.00317.71
8.1.30.0030.00617.82
8.1.20.0040.00417.96
8.1.10.0000.00817.78
8.1.00.0030.00517.72
8.0.300.0000.00720.15
8.0.290.0050.00317.13
8.0.280.0050.00318.75
8.0.270.0040.00417.52
8.0.260.0000.00717.18
8.0.250.0050.00217.14
8.0.240.0050.00317.29
8.0.230.0000.00717.38
8.0.220.0070.00017.28
8.0.210.0000.00717.13
8.0.200.0030.00317.25
8.0.190.0050.00217.36
8.0.180.0030.00617.29
8.0.170.0080.00017.23
8.0.160.0000.00817.10
8.0.150.0000.00917.19
8.0.140.0060.00617.21
8.0.130.0000.00613.64
8.0.120.0030.00517.20
8.0.110.0000.00717.12
8.0.100.0040.00417.30
8.0.90.0030.00517.12
8.0.80.0030.01817.32
8.0.70.0000.00817.04
8.0.60.0040.00417.27
8.0.50.0040.00417.27
8.0.30.0110.00717.40
8.0.20.0100.00817.51
8.0.10.0000.00717.46
8.0.00.0130.01017.21
7.4.330.0020.00213.25
7.4.320.0030.00316.74
7.4.300.0030.00316.88
7.4.290.0040.00416.79
7.4.280.0070.00016.91
7.4.270.0070.00016.89
7.4.260.0000.00513.50
7.4.250.0030.00616.77
7.4.240.0030.00316.65
7.4.230.0040.00316.90
7.4.220.0110.01116.79
7.4.210.0150.00016.82
7.4.200.0030.00316.81
7.4.190.0040.00417.05
7.4.160.0060.01616.93
7.4.150.0100.00716.92
7.4.140.0030.01316.90
7.4.130.0070.01016.77
7.4.120.0090.00916.86
7.4.110.0120.01816.89
7.4.100.0130.00617.03
7.4.90.0130.00416.70
7.4.80.0180.00419.39
7.4.70.0160.00316.84
7.4.60.0030.01416.66
7.4.50.0030.00616.71
7.4.40.0060.00916.55
7.4.30.0140.00316.83
7.4.00.0050.01014.97
7.3.330.0060.00013.64
7.3.320.0030.00513.45
7.3.310.0000.00716.77
7.3.300.0070.00016.58
7.3.290.0070.00816.66
7.3.280.0060.01016.60
7.3.270.0330.02316.96
7.3.260.0200.00816.64
7.3.250.0120.01316.92
7.3.240.0090.00916.91
7.3.230.0140.00316.61
7.3.210.0070.01416.71
7.3.200.0030.01316.76
7.3.190.0190.00316.70
7.3.180.0130.01016.50
7.3.170.0090.00616.54
7.3.160.0150.00316.94
7.3.120.0090.01014.88
7.3.110.0120.00315.12
7.3.100.0070.01015.21
7.3.90.0070.01015.12
7.3.80.0070.00715.09
7.3.70.0060.00914.87
7.3.60.0100.00614.86
7.3.50.0060.00614.88
7.3.40.0070.00714.92
7.3.30.0090.00614.98
7.3.20.0110.00016.70
7.3.10.0070.00716.77
7.3.00.0060.00916.96
7.2.330.0120.00617.00
7.2.320.0060.01617.02
7.2.310.0070.01016.98
7.2.300.0090.00917.12
7.2.290.0130.00317.11
7.2.250.0070.01115.39
7.2.240.0100.01015.15
7.2.230.0070.00715.34
7.2.220.0030.00715.11
7.2.210.0070.00715.09
7.2.200.0000.01315.09
7.2.190.0110.00015.06
7.2.180.0040.01215.09
7.2.170.0040.01215.04
7.2.60.0030.00917.13
7.1.330.0100.00315.96
7.1.320.0000.01315.93
7.1.310.0060.01215.95
7.1.300.0070.00715.65
7.1.290.0000.01816.08
7.1.280.0090.00315.69
7.1.270.0040.01115.82
7.1.260.0170.00015.91
7.1.200.0040.00816.10
7.1.70.0040.00417.36
7.1.60.0070.01819.31
7.1.50.0070.00716.98
7.1.00.0070.07022.51
7.0.200.0750.00315.00
7.0.140.0000.07722.19
7.0.120.0100.06322.16
7.0.60.0070.06020.01
7.0.50.0070.08318.05
7.0.40.0170.08020.12
7.0.30.0300.05720.30
7.0.20.0370.07720.38
7.0.10.0300.04320.31
7.0.00.0100.07720.31
5.6.280.0070.07021.21
5.6.210.0070.04320.75
5.6.200.0170.05718.33
5.6.190.0170.07020.60
5.6.180.0330.07720.82
5.6.170.0230.08720.70
5.6.160.0070.05020.64
5.6.150.0030.05018.38
5.6.140.0030.08318.38
5.6.130.0070.08318.21
5.6.120.0200.07721.24
5.6.110.0170.08321.22
5.6.100.0100.06321.19
5.6.90.0130.06721.24
5.6.80.0130.06020.64
5.6.70.0200.07720.61
5.5.350.0270.08320.61
5.5.340.0000.05318.05
5.5.330.0070.07320.34
5.5.320.0200.08020.58
5.5.310.0230.05720.46
5.5.300.0100.07718.15
5.5.290.0000.04718.12
5.5.280.0100.08321.05
5.5.270.0030.05320.90
5.5.260.0030.04021.04
5.5.250.0100.07720.73
5.5.240.0030.08720.34
5.4.450.0000.05319.26
5.4.440.0030.04019.27
5.4.430.0100.03319.48
5.4.420.0000.04019.52
5.4.410.0100.04019.39
5.4.400.0030.03719.20
5.4.390.0030.04319.28
5.4.380.0070.06719.35
5.4.370.0100.07319.39
5.4.360.0070.05019.35
5.4.350.0130.07019.38
5.4.340.0070.03719.08
5.4.320.0130.07319.08
5.4.310.0100.07719.39
5.4.300.0170.07019.30
5.4.290.0070.07719.34
5.4.280.0030.08319.29
5.4.270.0130.04019.29
5.4.260.0100.06018.93
5.4.250.0130.07319.23
5.4.240.0100.05019.23
5.4.230.0070.07719.36
5.4.220.0070.03719.27
5.4.210.0130.06719.07
5.4.200.0030.06318.92
5.4.190.0100.07319.37
5.4.180.0030.07719.18
5.4.170.0100.05318.91
5.4.160.0000.07318.91
5.4.150.0070.05719.43
5.4.140.0030.07316.45
5.4.130.0070.07716.69
5.4.120.0100.06316.44
5.4.110.0100.07016.56
5.4.100.0070.04016.80
5.4.90.0130.02716.42
5.4.80.0070.05316.45
5.4.70.0070.07316.51
5.4.60.0030.07316.72
5.4.50.0130.06716.57
5.4.40.0100.07016.55
5.4.30.0000.07716.44
5.4.20.0030.07716.57
5.4.10.0070.07716.56
5.4.00.0070.07015.93
5.3.290.0070.04314.60
5.3.280.0130.06314.69
5.3.270.0070.04714.58
5.3.260.0070.06014.53
5.3.250.0070.08014.50
5.3.240.0130.04314.57
5.3.230.0070.07314.68
5.3.220.0070.07714.50
5.3.210.0070.05714.49
5.3.200.0070.07014.59
5.3.190.0000.04014.51
5.3.180.0070.04014.51
5.3.170.0130.06014.60
5.3.160.0100.07314.49
5.3.150.0100.06314.46
5.3.140.0100.04314.45
5.3.130.0100.07714.48
5.3.120.0100.06714.45
5.3.110.0070.07314.37
5.3.100.0000.05313.96
5.3.90.0070.07314.11
5.3.80.0130.06713.99
5.3.70.0100.04013.94
5.3.60.0070.07313.97
5.3.50.0130.03313.87
5.3.40.0100.07313.87
5.3.30.0100.05713.93
5.3.20.0100.04013.52
5.3.10.0000.05013.49
5.3.00.0170.06313.47
5.2.170.0030.04711.30
5.2.160.0100.04311.00
5.2.150.0070.04311.11
5.2.140.0000.03711.02
5.2.130.0030.03311.04
5.2.120.0000.03011.05
5.2.110.0100.03711.09
5.2.100.0000.06711.00
5.2.90.0030.03010.96
5.2.80.0100.06011.10
5.2.70.0070.04711.25
5.2.60.0070.04311.13
5.2.50.0000.04010.98
5.2.40.0000.04010.96
5.2.30.0000.06310.91
5.2.20.0030.04710.85
5.2.10.0000.04010.94
5.2.00.0070.02710.72
5.1.60.0030.0479.98
5.1.50.0070.02010.04
5.1.40.0030.04010.00
5.1.30.0030.02310.19
5.1.20.0030.06010.36
5.1.10.0030.0309.97
5.1.00.0030.0239.97
5.0.50.0100.0408.62
5.0.40.0030.0238.25
5.0.30.0030.0378.18
5.0.20.0000.0208.26
5.0.10.0070.0408.23
5.0.00.0100.0578.24
4.4.90.0030.0207.88
4.4.80.0030.0237.88
4.4.70.0000.0207.88
4.4.60.0030.0337.88
4.4.50.0030.0207.88
4.4.40.0000.0277.88
4.4.30.0000.0207.88
4.4.20.0100.0077.88
4.4.10.0030.0177.88
4.4.00.0030.0377.88
4.3.110.0000.0277.88
4.3.100.0070.0107.88
4.3.90.0000.0407.88
4.3.80.0000.0377.88
4.3.70.0030.0277.88
4.3.60.0000.0377.88
4.3.50.0100.0307.88
4.3.40.0000.0437.88
4.3.30.0030.0177.88
4.3.20.0070.0337.88
4.3.10.0130.0277.88
4.3.00.0030.0377.88

preferences:
59.09 ms | 401 KiB | 5 Q