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); echo $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.60.0040.01117.00
8.3.50.0130.00822.18
8.3.40.0090.00918.91
8.3.30.0140.00019.41
8.3.20.0080.00020.59
8.3.10.0050.00323.66
8.3.00.0050.00221.14
8.2.180.0000.01518.88
8.2.170.0080.00822.96
8.2.160.0130.00320.78
8.2.150.0030.00624.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0060.00322.46
8.2.110.0100.00022.51
8.2.100.0040.00818.16
8.2.90.0060.00319.48
8.2.80.0000.00818.00
8.2.70.0000.00917.75
8.2.60.0040.00418.18
8.2.50.0080.00018.07
8.2.40.0090.00020.13
8.2.30.0000.00818.48
8.2.20.0050.00318.02
8.2.10.0080.00018.41
8.2.00.0040.00818.06
8.1.280.0120.00325.92
8.1.270.0040.00424.09
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0070.00324.02
8.1.230.0060.00619.47
8.1.220.0030.00617.91
8.1.210.0050.00318.77
8.1.200.0100.00017.60
8.1.190.0000.00817.47
8.1.180.0030.00619.26
8.1.170.0030.00518.86
8.1.160.0000.00922.31
8.1.150.0000.00718.86
8.1.140.0000.00817.84
8.1.130.0070.00018.17
8.1.120.0030.00517.75
8.1.110.0080.00017.63
8.1.100.0050.00317.80
8.1.90.0040.00417.74
8.1.80.0040.00417.77
8.1.70.0050.00517.74
8.1.60.0000.00817.79
8.1.50.0050.00317.81
8.1.40.0060.00317.70
8.1.30.0000.00818.03
8.1.20.0050.00317.84
8.1.10.0030.00517.88
8.1.00.0040.00417.71
8.0.300.0040.00418.77
8.0.290.0080.00017.27
8.0.280.0030.00318.66
8.0.270.0040.00417.54
8.0.260.0030.00317.58
8.0.250.0040.00417.34
8.0.240.0060.00317.24
8.0.230.0000.00717.36
8.0.220.0070.00017.25
8.0.210.0040.00417.25
8.0.200.0040.00417.39
8.0.190.0060.00317.32
8.0.180.0020.00517.32
8.0.170.0030.00617.29
8.0.160.0080.00017.25
8.0.150.0040.00417.07
8.0.140.0040.00417.19
8.0.130.0000.00513.60
8.0.120.0000.00817.11
8.0.110.0000.00817.23
8.0.100.0080.00017.25
8.0.90.0000.00717.35
8.0.80.0090.00917.27
8.0.70.0050.00317.32
8.0.60.0040.00417.25
8.0.50.0000.00717.25
8.0.30.0150.00717.29
8.0.20.0090.01017.55
8.0.10.0000.00717.30
8.0.00.0090.00917.15
7.4.330.0050.00015.00
7.4.320.0060.00016.81
7.4.300.0000.00616.80
7.4.290.0020.00516.73
7.4.280.0040.00416.79
7.4.270.0030.00316.79
7.4.260.0000.00816.78
7.4.250.0000.00816.86
7.4.240.0000.00716.83
7.4.230.0070.00016.57
7.4.220.0060.01216.80
7.4.210.0080.00716.95
7.4.200.0000.00716.90
7.4.190.0040.00416.64
7.4.160.0090.00616.80
7.4.150.0080.01217.40
7.4.140.0080.01017.86
7.4.130.0070.01016.83
7.4.120.0110.00716.81
7.4.110.0110.00716.70
7.4.100.0130.00717.00
7.4.90.0100.00716.88
7.4.80.0200.00719.39
7.4.70.0030.01616.94
7.4.60.0070.01116.91
7.4.50.0000.00516.88
7.4.40.0060.01116.58
7.4.30.0130.00316.89
7.4.00.0050.01115.11
7.3.330.0070.00013.70
7.3.320.0030.00313.67
7.3.310.0050.00316.70
7.3.300.0050.00216.74
7.3.290.0090.01216.72
7.3.280.0080.01016.73
7.3.270.0070.01017.40
7.3.260.0120.01216.69
7.3.250.0110.01016.89
7.3.240.0110.00616.70
7.3.230.0130.00316.74
7.3.210.0140.00316.71
7.3.200.0070.01319.39
7.3.190.0170.00416.81
7.3.180.0080.00816.71
7.3.170.0060.01216.81
7.3.160.0120.00416.76
7.3.120.0030.01415.13
7.3.110.0040.01514.83
7.3.100.0100.00315.14
7.3.90.0080.00815.07
7.3.80.0070.00714.91
7.3.70.0000.01414.92
7.3.60.0130.00314.99
7.3.50.0110.00314.92
7.3.40.0050.00314.87
7.3.30.0060.00314.88
7.3.20.0030.01016.65
7.3.10.0060.00917.05
7.3.00.0060.00616.82
7.2.330.0160.01417.02
7.2.320.0090.00917.02
7.2.310.0120.00617.00
7.2.300.0060.01017.03
7.2.290.0060.01216.73
7.2.250.0090.00315.05
7.2.240.0110.00715.21
7.2.230.0000.01015.37
7.2.220.0070.01115.14
7.2.210.0090.00615.30
7.2.200.0090.00615.26
7.2.190.0100.00315.05
7.2.180.0030.01015.25
7.2.170.0000.01115.37
7.2.60.0060.00916.92
7.2.00.0040.00819.74
7.1.330.0060.00916.09
7.1.320.0070.01015.74
7.1.310.0060.00915.88
7.1.300.0090.00315.95
7.1.290.0090.00315.71
7.1.280.0060.00916.00
7.1.270.0080.00415.74
7.1.260.0070.00315.86
7.1.200.0070.00716.05
7.1.100.0170.00018.19
7.1.70.0040.00917.48
7.1.60.0150.00619.46
7.1.50.0030.02017.07
7.1.00.0070.07722.58
7.0.200.0000.00816.81
7.0.140.0130.08722.13
7.0.70.0070.07321.78
7.0.60.0070.07721.96
7.0.50.0000.05022.20
7.0.40.0070.08020.25
7.0.30.0030.09020.12
7.0.20.0030.09020.19
7.0.10.0070.07020.12
7.0.00.0070.07320.25
5.6.280.0100.06721.22
5.6.220.0030.05020.90
5.6.210.0030.08320.66
5.6.200.0030.08721.24
5.6.190.0030.07721.21
5.6.180.0000.07721.13
5.6.170.0030.09021.16
5.6.160.0030.09021.21
5.6.150.0030.08021.01
5.6.140.0030.04321.18
5.6.130.0000.05721.20
5.6.120.0000.08721.28
5.6.110.0000.08321.20
5.6.100.0000.04721.00
5.6.90.0030.04020.99
5.6.80.0000.06320.48
5.6.70.0070.07320.53
5.6.60.0100.07720.47
5.6.50.0030.06020.54
5.6.40.0030.08020.54
5.6.30.0030.05720.51
5.6.20.0030.05020.36
5.6.10.0030.07720.64
5.6.00.0030.08020.35
5.5.360.0070.04720.48
5.5.350.0070.08020.42
5.5.340.0070.08020.98
5.5.330.0030.04020.91
5.5.320.0000.06320.79
5.5.310.0070.05720.95
5.5.300.0070.08321.07
5.5.290.0030.06721.03
5.5.280.0030.08320.83
5.5.270.0070.05020.90
5.5.260.0000.07020.90
5.5.250.0030.04320.87
5.5.240.0070.03720.45
5.5.230.0000.05720.35
5.5.220.0070.05320.43
5.5.210.0000.05720.39
5.5.200.0100.07320.43
5.5.190.0100.08020.22
5.5.180.0000.05020.35
5.5.160.0100.05720.26
5.5.150.0070.07020.39
5.5.140.0070.03720.18
5.5.130.0030.05320.35
5.5.120.0100.05020.22
5.5.110.0000.08320.24
5.5.100.0030.08020.14
5.5.90.0070.07020.14
5.5.80.0000.08020.24
5.5.70.0070.08020.14
5.5.60.0000.06720.25
5.5.50.0070.07320.19
5.5.40.0070.04720.28
5.5.30.0000.07720.25
5.5.20.0100.07020.25
5.5.10.0070.07720.14
5.5.00.0100.06720.20
5.4.450.0100.08019.62
5.4.440.0000.08019.65
5.4.430.0070.07719.64
5.4.420.0070.05319.27
5.4.410.0000.08319.52
5.4.400.0000.07319.29
5.4.390.0130.07019.26
5.4.380.0070.07019.20
5.4.370.0000.07719.16
5.4.360.0070.07319.22
5.4.350.0000.05319.24
5.4.340.0030.04719.28
5.4.320.0070.08019.32
5.4.310.0070.07019.11
5.4.300.0000.05019.27
5.4.290.0030.05319.28
5.4.280.0030.06319.24
5.4.270.0070.07718.95
5.4.260.0130.03319.34
5.4.250.0100.07019.11
5.4.240.0030.08019.36
5.4.230.0030.06319.23
5.4.220.0030.08018.94
5.4.210.0000.04318.92
5.4.200.0070.07319.36
5.4.190.0100.07019.27
5.4.180.0100.07319.25
5.4.170.0030.05319.24
5.4.160.0030.04719.09
5.4.150.0030.06019.07
5.4.140.0000.08016.55
5.4.130.0000.08016.64
5.4.120.0030.06316.64
5.4.110.0030.07316.52
5.4.100.0000.06716.46
5.4.90.0030.07716.63
5.4.80.0000.07716.66
5.4.70.0030.07316.48
5.4.60.0070.07316.50
5.4.50.0030.07716.49
5.4.40.0000.08016.66
5.4.30.0030.06716.46
5.4.20.0100.06716.57
5.4.10.0070.04716.73
5.4.00.0070.06716.03
5.3.290.0100.06714.65
5.3.280.0030.06014.53
5.3.270.0000.04714.59
5.3.260.0030.07714.59
5.3.250.0030.04314.47
5.3.240.0000.07014.47
5.3.230.0030.07014.55
5.3.220.0130.06714.52
5.3.210.0070.07714.53
5.3.200.0130.07014.56
5.3.190.0030.07314.48
5.3.180.0130.06314.40
5.3.170.0000.06714.56
5.3.160.0070.06714.42
5.3.150.0000.05314.54
5.3.140.0070.05314.41
5.3.130.0000.06714.38
5.3.120.0070.07314.50
5.3.110.0030.07714.41
5.3.100.0030.08014.05
5.3.90.0130.06314.01
5.3.80.0000.07313.96
5.3.70.0070.06714.00
5.3.60.0000.06013.98
5.3.50.0030.07013.93
5.3.40.0030.07013.93
5.3.30.0030.07713.92
5.3.20.0000.07313.67
5.3.10.0070.06013.51
5.3.00.0030.07313.49
5.2.170.0000.06312.52
5.2.160.0000.06712.52
5.2.150.0030.06012.52
5.2.140.0000.05712.52
5.2.130.0000.06012.52
5.2.120.0000.06312.52
5.2.110.0000.06712.52
5.2.100.0070.06012.52
5.2.90.0030.06312.52
5.2.80.0030.06312.52
5.2.70.0030.05712.52
5.2.60.0030.05012.52
5.2.50.0000.05312.52
5.2.40.0030.05712.52
5.2.30.0030.05712.52
5.2.20.0030.05012.52
5.2.10.0000.05312.52
5.2.00.0000.06312.52
5.1.60.0070.04312.52
5.1.50.0000.05712.52
5.1.40.0000.04012.52
5.1.30.0000.04012.52
5.1.20.0030.02712.52
5.1.10.0030.04712.52
5.1.00.0030.05312.52
5.0.50.0000.05012.52
5.0.40.0070.02712.52
5.0.30.0000.07012.52
5.0.20.0000.04012.52
5.0.10.0000.04312.52
5.0.00.0100.05712.52
4.4.90.0000.02712.52
4.4.80.0030.03312.52
4.4.70.0030.03712.52
4.4.60.0000.03712.52
4.4.50.0030.03712.52
4.4.40.0000.05012.52
4.4.30.0000.03012.52
4.4.20.0030.03312.52
4.4.10.0030.02712.52
4.4.00.0030.05012.52
4.3.110.0000.03712.52
4.3.100.0000.03312.52
4.3.90.0070.02312.52
4.3.80.0000.04712.52
4.3.70.0070.02012.52
4.3.60.0000.03712.52
4.3.50.0000.03712.52
4.3.40.0000.05012.52
4.3.30.0000.03712.52
4.3.20.0030.03312.52
4.3.10.0000.03712.52
4.3.00.0000.03712.52

preferences:
40.47 ms | 401 KiB | 5 Q