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, $attrVal); } } } 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.0090.00617.13
8.3.50.0160.00722.12
8.3.40.0070.00719.27
8.3.30.0110.00419.19
8.3.20.0050.00320.60
8.3.10.0080.00023.93
8.3.00.0060.00319.63
8.2.180.0110.01118.79
8.2.170.0130.00322.96
8.2.160.0070.01020.82
8.2.150.0000.00824.18
8.2.140.0140.00324.66
8.2.130.0080.00026.16
8.2.120.0080.00022.37
8.2.110.0040.00422.46
8.2.100.0090.00318.16
8.2.90.0000.00819.37
8.2.80.0000.00818.30
8.2.70.0000.00917.88
8.2.60.0060.00318.15
8.2.50.0080.00018.07
8.2.40.0040.00418.41
8.2.30.0040.00418.46
8.2.20.0000.00818.04
8.2.10.0000.00718.48
8.2.00.0040.00418.02
8.1.280.0110.00425.92
8.1.270.0050.00324.13
8.1.260.0030.00626.35
8.1.250.0000.00828.09
8.1.240.0030.00624.09
8.1.230.0110.00019.35
8.1.220.0040.00418.01
8.1.210.0040.00418.77
8.1.200.0000.00917.60
8.1.190.0000.00817.89
8.1.180.0030.00618.10
8.1.170.0040.00418.91
8.1.160.0050.00322.29
8.1.150.0080.00018.97
8.1.140.0040.00417.70
8.1.130.0000.00718.10
8.1.120.0050.00217.75
8.1.110.0080.00017.60
8.1.100.0040.00417.79
8.1.90.0030.00517.75
8.1.80.0040.00417.65
8.1.70.0030.00717.77
8.1.60.0060.00317.74
8.1.50.0080.00017.79
8.1.40.0050.00317.91
8.1.30.0050.00317.95
8.1.20.0040.00418.05
8.1.10.0040.00417.82
8.1.00.0040.00417.68
8.0.300.0060.00318.77
8.0.290.0070.00017.43
8.0.280.0000.00818.71
8.0.270.0030.00317.54
8.0.260.0040.00417.15
8.0.250.0030.00317.41
8.0.240.0000.00717.30
8.0.230.0040.00417.31
8.0.220.0030.00317.27
8.0.210.0040.00417.21
8.0.200.0020.00517.19
8.0.190.0060.00317.40
8.0.180.0000.00717.28
8.0.170.0040.00417.30
8.0.160.0040.00417.25
8.0.150.0000.00817.10
8.0.140.0060.00317.07
8.0.130.0030.00313.61
8.0.120.0080.00017.24
8.0.110.0050.00317.16
8.0.100.0000.00817.12
8.0.90.0040.00417.18
8.0.80.0090.00617.28
8.0.70.0080.00017.28
8.0.60.0070.00017.32
8.0.50.0080.00017.24
8.0.30.0170.00317.30
8.0.20.0110.00817.54
8.0.10.0050.00317.40
8.0.00.0090.00817.09
7.4.330.0000.00615.32
7.4.320.0060.00016.88
7.4.300.0040.00416.87
7.4.290.0040.00416.90
7.4.280.0080.00016.95
7.4.270.0030.00316.77
7.4.260.0060.00316.86
7.4.250.0070.00016.77
7.4.240.0050.00316.84
7.4.230.0030.00316.63
7.4.220.0120.00916.90
7.4.210.0050.01316.89
7.4.200.0070.00016.94
7.4.190.0040.00416.94
7.4.160.0060.01216.77
7.4.150.0070.01117.40
7.4.140.0050.01317.86
7.4.130.0140.00416.81
7.4.120.0050.01316.84
7.4.110.0160.00316.96
7.4.100.0140.00416.68
7.4.90.0080.00916.82
7.4.80.0090.00919.39
7.4.70.0080.00916.77
7.4.60.0100.00616.82
7.4.50.0040.00416.67
7.4.40.0040.01222.77
7.4.30.0130.00816.83
7.4.00.0090.00615.27
7.3.330.0000.00513.67
7.3.320.0030.00313.48
7.3.310.0050.00316.56
7.3.300.0040.00416.75
7.3.290.0090.00616.74
7.3.280.0120.00716.63
7.3.270.0140.00317.40
7.3.260.0120.00616.76
7.3.250.0130.00416.81
7.3.240.0080.01516.93
7.3.230.0030.01416.84
7.3.210.0120.00916.80
7.3.200.0060.01219.39
7.3.190.0150.00816.72
7.3.180.0070.01116.84
7.3.170.0080.00816.65
7.3.160.0120.00916.83
7.3.120.0100.00714.98
7.3.10.0090.00616.43
7.3.00.0110.00416.07
7.2.330.0090.00917.18
7.2.320.0030.01317.08
7.2.310.0100.00717.11
7.2.300.0030.01416.91
7.2.290.0030.01416.84
7.2.130.0080.01117.14
7.2.120.0080.00816.83
7.2.110.0060.00916.74
7.2.100.0060.01316.14
7.2.90.0120.00916.30
7.2.80.0120.00616.59
7.2.70.0170.00316.92
7.2.60.0080.01216.97
7.2.50.0120.01516.53
7.2.40.0180.00516.71
7.2.30.0160.00416.66
7.2.20.0110.00816.52
7.2.10.0160.00716.89
7.2.00.0220.00016.90
7.1.250.0160.00315.42
7.1.200.0030.00715.75
7.1.70.0100.00317.32
7.1.60.0100.00019.33
7.1.50.0100.01317.12
7.1.00.0070.07022.53
7.0.200.0050.00316.92
7.0.140.0030.07322.23
7.0.110.0470.04020.14
7.0.100.0400.08020.13
7.0.90.0700.08020.09
7.0.80.0630.08320.03
7.0.70.0470.07719.98
7.0.60.0370.08320.07
7.0.50.0100.06720.35
7.0.40.0030.08020.10
7.0.30.0130.07720.35
7.0.20.0130.08020.26
7.0.10.0000.05320.25
7.0.00.0070.08720.37
5.6.280.0070.07021.11
5.6.260.0130.08020.72
5.6.250.0100.08020.75
5.6.240.0130.07720.78
5.6.230.0030.08720.75
5.6.220.0070.07720.68
5.6.210.0030.08320.66
5.6.200.0000.05321.23
5.6.190.0130.07721.13
5.6.180.0130.07321.10
5.6.170.0070.08321.17
5.6.160.0100.08021.07
5.6.150.0000.08721.32
5.6.140.0130.07021.13
5.6.130.0100.08321.17
5.6.120.0030.08321.16
5.6.110.0100.08721.27
5.6.100.0030.08721.18
5.6.90.0230.07021.38
5.6.80.0130.06020.71
5.6.70.0100.06720.79
5.6.60.0100.07320.67
5.6.50.0170.07320.77
5.6.40.0030.06720.78
5.6.30.0100.07720.63
5.6.20.0170.07020.51
5.6.10.0200.06720.77
5.6.00.0100.07020.50
5.5.380.0170.07020.45
5.5.370.0100.07720.62
5.5.360.0070.08320.63
5.5.350.0100.07020.56
5.5.340.0100.07720.89
5.5.330.0070.08321.17
5.5.320.0070.06721.09
5.5.310.0130.06321.16
5.5.300.0030.08720.92
5.5.290.0100.08021.07
5.5.280.0030.06021.09
5.5.270.0100.07320.88
5.5.260.0100.07320.81
5.5.250.0170.07320.71
5.5.240.0030.08720.27
5.5.230.0030.08020.46
5.5.220.0070.07020.15
5.5.210.0130.06720.55
5.5.200.0030.08320.33
5.5.190.0170.07020.22
5.5.180.0070.04320.39
5.5.160.0100.06320.42
5.5.150.0100.06320.16
5.5.140.0100.07020.20
5.5.130.0070.06720.41
5.5.120.0100.04020.41
5.5.110.0100.07720.22
5.5.100.0170.07020.10
5.5.90.0100.07020.29
5.5.80.0100.08020.33
5.5.70.0000.06720.05
5.5.60.0100.07020.36
5.5.50.0130.07020.32
5.5.40.0170.05720.39
5.5.30.0070.07720.38
5.5.20.0070.05020.29
5.5.10.0070.07320.11
5.5.00.0070.08019.98
5.4.450.0170.07319.57
5.4.440.0130.06719.69
5.4.430.0070.05719.73
5.4.420.0100.07319.70
5.4.410.0100.07319.22
5.4.400.0030.06719.30
5.4.390.0070.07719.08
5.4.380.0070.07319.10
5.4.370.0030.07719.24
5.4.360.0070.08019.28
5.4.350.0070.07319.36
5.4.340.0030.07719.41
5.4.320.0000.07719.08
5.4.310.0130.06719.23
5.4.300.0130.07319.22
5.4.290.0030.07319.23
5.4.280.0100.07319.38
5.4.270.0070.07719.36
5.4.260.0070.04719.21
5.4.250.0030.07019.25
5.4.240.0100.07719.23
5.4.230.0030.07019.37
5.4.220.0030.08019.25
5.4.210.0070.07019.07
5.4.200.0070.07319.38
5.4.190.0070.07019.40
5.4.180.0170.06319.09
5.4.170.0070.06019.07
5.4.160.0070.07319.06
5.4.150.0070.08019.23
5.4.140.0070.07016.78
5.4.130.0030.04716.59
5.4.120.0070.04316.68
5.4.110.0070.04316.74
5.4.100.0070.07316.54
5.4.90.0030.07316.75
5.4.80.0100.06316.77
5.4.70.0070.07316.71
5.4.60.0030.07316.37
5.4.50.0100.07016.70
5.4.40.0100.07316.77
5.4.30.0070.07316.63
5.4.20.0070.07716.63
5.4.10.0030.05016.36
5.4.00.0100.05715.93
5.3.290.0100.08014.60
5.3.280.0100.07014.53
5.3.270.0100.06714.40
5.3.260.0030.07014.51
5.3.250.0000.07714.47
5.3.240.0130.07014.68
5.3.230.0030.07314.45
5.3.220.0030.08314.60
5.3.210.0030.07314.49
5.3.200.0130.07014.36
5.3.190.0100.07014.47
5.3.180.0070.07014.41
5.3.170.0070.07314.57
5.3.160.0100.07014.58
5.3.150.0130.06714.56
5.3.140.0070.07014.55
5.3.130.0130.07014.44
5.3.120.0100.05714.43
5.3.110.0030.07314.45
5.3.100.0100.06713.89
5.3.90.0100.07313.97
5.3.80.0070.04713.89
5.3.70.0100.07013.80
5.3.60.0070.08013.85
5.3.50.0100.06713.80
5.3.40.0100.07013.84
5.3.30.0070.07013.80
5.3.20.0030.07013.58
5.3.10.0030.07013.72
5.3.00.0100.06313.58
5.2.170.0000.06711.93
5.2.160.0030.06011.93
5.2.150.0000.07011.93
5.2.140.0030.06311.93
5.2.130.0000.05711.93
5.2.120.0070.04711.93
5.2.110.0030.05311.93
5.2.100.0070.04711.93
5.2.90.0100.05711.93
5.2.80.0070.05711.93
5.2.70.0170.04311.93
5.2.60.0100.05311.93
5.2.50.0030.03711.93
5.2.40.0030.05711.93
5.2.30.0000.05711.93
5.2.20.0030.05011.93
5.2.10.0030.06011.93
5.2.00.0030.04011.93
5.1.60.0000.05011.93
5.1.50.0030.05311.93
5.1.40.0030.02311.93
5.1.30.0070.04711.93
5.1.20.0030.04711.93
5.1.10.0030.06011.93
5.1.00.0070.03011.93
5.0.50.0030.04711.93
5.0.40.0030.04711.93
5.0.30.0030.05711.93
5.0.20.0030.04311.93
5.0.10.0100.01711.93
5.0.00.0070.05711.93
4.4.90.0030.03311.93
4.4.80.0000.03311.93
4.4.70.0030.03311.93
4.4.60.0070.03311.93
4.4.50.0030.03311.93
4.4.40.0000.04711.93
4.4.30.0000.03711.93
4.4.20.0070.03011.93
4.4.10.0070.03011.93
4.4.00.0030.05311.93
4.3.110.0030.03311.93
4.3.100.0100.02711.93
4.3.90.0000.03711.93
4.3.80.0000.05311.93
4.3.70.0000.03711.93
4.3.60.0070.03011.93
4.3.50.0000.03711.93
4.3.40.0000.05311.93
4.3.30.0000.03711.93
4.3.20.0070.03011.93
4.3.10.0000.03711.93
4.3.00.0000.03711.93

preferences:
36.78 ms | 401 KiB | 5 Q