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) { $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.0040.01117.13
8.3.50.0130.00917.71
8.3.40.0110.00419.10
8.3.30.0070.00719.22
8.3.20.0040.00419.15
8.3.10.0060.00318.95
8.3.00.0080.00019.63
8.2.180.0200.00317.00
8.2.170.0120.00322.96
8.2.160.0030.01020.72
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.51
8.2.110.0030.00621.31
8.2.100.0060.00618.09
8.2.90.0030.00719.58
8.2.80.0040.00419.51
8.2.70.0040.00417.75
8.2.60.0100.00018.18
8.2.50.0000.00818.07
8.2.40.0060.00318.47
8.2.30.0000.00818.30
8.2.20.0000.00817.98
8.2.10.0040.00418.05
8.2.00.0050.00318.14
8.1.280.0070.01125.92
8.1.270.0080.00024.66
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00724.23
8.1.230.0060.00620.96
8.1.220.0040.00418.03
8.1.210.0040.00419.09
8.1.200.0050.00517.60
8.1.190.0000.00917.77
8.1.180.0080.00018.10
8.1.170.0050.00319.10
8.1.160.0000.00819.19
8.1.150.0070.00018.95
8.1.140.0050.00217.72
8.1.130.0040.00418.09
8.1.120.0040.00417.76
8.1.110.0020.00517.74
8.1.100.0030.00517.81
8.1.90.0000.00717.76
8.1.80.0000.00717.82
8.1.70.0040.00417.79
8.1.60.0030.00617.90
8.1.50.0040.00417.65
8.1.40.0060.00317.81
8.1.30.0030.00517.98
8.1.20.0000.00817.89
8.1.10.0040.00417.91
8.1.00.0070.00017.82
8.0.300.0050.00320.11
8.0.290.0020.00517.13
8.0.280.0000.00718.71
8.0.270.0000.00717.59
8.0.260.0030.00317.16
8.0.250.0000.00817.34
8.0.240.0000.00717.32
8.0.230.0070.00017.29
8.0.220.0000.00717.12
8.0.210.0020.00517.34
8.0.200.0030.00317.21
8.0.190.0070.00017.32
8.0.180.0060.00317.15
8.0.170.0040.00717.31
8.0.160.0000.00817.31
8.0.150.0000.01017.05
8.0.140.0000.01117.12
8.0.130.0030.00313.63
8.0.120.0040.00417.07
8.0.110.0040.00417.32
8.0.100.0040.00417.24
8.0.90.0080.00017.17
8.0.80.0060.00917.15
8.0.70.0000.00717.11
8.0.60.0040.00417.16
8.0.50.0040.00417.07
8.0.30.0130.00717.17
8.0.20.0110.00817.45
8.0.10.0000.00817.33
8.0.00.0110.00817.12
7.4.330.0000.00613.29
7.4.320.0000.00716.86
7.4.300.0030.00316.84
7.4.290.0000.01016.93
7.4.280.0040.00416.80
7.4.270.0060.00316.68
7.4.260.0030.00313.55
7.4.250.0050.00316.94
7.4.240.0050.00216.82
7.4.230.0050.00216.93
7.4.220.0190.00016.79
7.4.210.0080.00916.82
7.4.200.0030.00416.98
7.4.190.0030.00516.96
7.4.160.0100.00616.88
7.4.150.0070.01116.82
7.4.140.0090.00916.87
7.4.130.0130.00516.79
7.4.120.0060.01116.91
7.4.110.0160.00816.80
7.4.100.0070.01116.72
7.4.90.0060.01216.81
7.4.80.0130.00919.39
7.4.70.0080.01316.92
7.4.60.0110.01116.78
7.4.50.0100.00316.99
7.4.40.0070.01116.66
7.4.30.0040.01416.82
7.4.00.0070.00715.00
7.3.330.0070.00013.73
7.3.320.0000.00613.51
7.3.310.0070.00016.64
7.3.300.0070.00016.77
7.3.290.0110.00416.66
7.3.280.0110.00816.72
7.3.270.0150.00316.79
7.3.260.0150.00316.93
7.3.250.0120.00616.63
7.3.240.0070.01016.78
7.3.230.0040.01616.74
7.3.210.0100.00916.69
7.3.200.0060.01516.69
7.3.190.0040.01916.69
7.3.180.0090.00616.65
7.3.170.0070.01116.73
7.3.160.0130.00316.75
7.3.120.0100.00714.89
7.2.330.0130.00417.13
7.2.320.0070.01317.16
7.2.310.0000.02017.15
7.2.300.0040.01316.98
7.2.290.0000.01617.11
7.2.60.0080.00816.96
7.2.00.0120.00419.23
7.1.200.0000.01115.86
7.1.100.0080.00618.39
7.1.70.0090.00017.45
7.1.60.0040.02119.40
7.1.50.0060.01617.04
7.1.00.0000.03722.63
7.0.200.0000.00817.08
7.0.140.0030.07322.23
7.0.120.0070.06322.18
7.0.60.0130.05720.06
7.0.50.0070.07717.97
7.0.40.0100.05717.93
7.0.30.0030.07017.93
7.0.20.0030.07017.87
7.0.10.0030.07717.89
7.0.00.0100.04017.83
5.6.280.0070.07021.19
5.6.210.0030.04020.90
5.6.200.0230.05318.43
5.6.190.0070.04018.33
5.6.180.0030.05018.40
5.6.170.0070.07018.42
5.6.160.0030.05718.33
5.6.150.0070.07018.39
5.6.140.0100.07318.26
5.6.130.0100.08018.44
5.6.120.0000.07018.34
5.6.110.0100.04718.41
5.6.100.0100.07018.27
5.6.90.0000.04718.38
5.6.80.0070.07017.79
5.6.70.0070.07717.73
5.6.60.0130.07017.64
5.6.50.0170.06717.60
5.6.40.0030.08317.67
5.6.30.0100.06717.62
5.6.20.0100.07317.68
5.6.10.0070.06717.73
5.6.00.0070.05717.72
5.5.350.0130.04720.46
5.5.340.0070.08318.11
5.5.330.0070.04018.06
5.5.320.0100.06317.99
5.5.310.0100.07717.99
5.5.300.0100.07717.99
5.5.290.0070.05017.99
5.5.280.0070.06318.15
5.5.270.0000.08718.17
5.5.260.0000.05318.16
5.5.250.0030.05317.88
5.5.240.0130.06317.55
5.5.230.0070.07717.56
5.5.220.0100.07017.39
5.5.210.0070.05317.50
5.5.200.0000.04717.56
5.5.190.0100.08017.41
5.5.180.0130.07317.41
5.5.160.0070.07717.48
5.5.150.0030.06317.54
5.5.140.0100.07017.43
5.5.130.0070.08017.54
5.5.120.0030.04017.55
5.5.110.0100.06017.53
5.5.100.0130.06317.34
5.5.90.0030.05317.39
5.5.80.0000.06017.38
5.5.70.0070.05717.45
5.5.60.0070.07017.27
5.5.50.0070.07017.42
5.5.40.0100.06717.41
5.5.30.0070.08017.39
5.5.20.0070.07717.36
5.5.10.0070.08017.39
5.5.00.0130.07017.41
5.4.450.0070.08019.59
5.4.440.0030.07319.36
5.4.430.0070.08019.38
5.4.420.0070.04019.38
5.4.410.0070.03719.25
5.4.400.0030.08019.03
5.4.390.0130.07319.17
5.4.380.0070.07719.10
5.4.370.0070.03719.26
5.4.360.0030.05018.96
5.4.350.0000.07319.17
5.4.340.0030.06319.16
5.4.320.0070.07719.02
5.4.310.0130.07019.28
5.4.300.0130.07019.13
5.4.290.0030.05319.11
5.4.280.0000.05719.21
5.4.270.0000.04319.05
5.4.260.0030.07719.12
5.4.250.0000.08719.05
5.4.240.0030.08019.22
5.4.230.0000.08019.12
5.4.220.0100.07719.04
5.4.210.0000.08019.22
5.4.200.0100.06019.21
5.4.190.0000.04719.01
5.4.180.0130.04019.17
5.4.170.0070.08019.25
5.4.160.0030.08019.07
5.4.150.0070.07719.19
5.4.140.0130.06016.65
5.4.130.0100.07016.55
5.4.120.0100.07316.55
5.4.110.0070.04716.48
5.4.100.0030.07316.66
5.4.90.0030.04716.51
5.4.80.0070.06716.52
5.4.70.0100.07016.56
5.4.60.0000.04016.69
5.4.50.0100.06016.53
5.4.40.0070.07016.58
5.4.30.0170.06716.58
5.4.20.0070.06716.52
5.4.10.0000.06716.50
5.4.00.0070.07016.00
5.3.290.0130.07314.59
5.3.280.0070.07714.68
5.3.270.0030.06314.46
5.3.260.0070.07714.68
5.3.250.0200.05014.53
5.3.240.0030.04714.44
5.3.230.0100.07314.52
5.3.220.0100.07014.50
5.3.210.0070.07714.65
5.3.200.0070.04714.36
5.3.190.0030.07714.54
5.3.180.0170.06314.50
5.3.170.0070.07714.42
5.3.160.0070.07314.34
5.3.150.0030.08014.55
5.3.140.0070.07014.50
5.3.130.0100.06714.38
5.3.120.0070.05714.32
5.3.110.0070.05014.32
5.3.100.0000.05313.86
5.3.90.0070.07013.84
5.3.80.0070.08313.95
5.3.70.0130.06713.97
5.3.60.0170.06013.76
5.3.50.0070.04313.73
5.3.40.0170.06313.88
5.3.30.0070.05013.86
5.3.20.0270.04013.67
5.3.10.0070.07013.59
5.3.00.0070.03313.60
5.2.170.0030.03710.97
5.2.160.0070.03011.12
5.2.150.0000.04710.93
5.2.140.0070.02711.14
5.2.130.0070.06011.11
5.2.120.0030.06011.08
5.2.110.0170.04710.93
5.2.100.0000.03311.09
5.2.90.0030.02711.00
5.2.80.0030.06310.91
5.2.70.0000.05311.03
5.2.60.0000.03711.03
5.2.50.0070.06310.99
5.2.40.0000.05310.86
5.2.30.0070.05310.79
5.2.20.0130.05310.95
5.2.10.0070.04710.71
5.2.00.0070.05010.70
5.1.60.0070.0509.97
5.1.50.0000.03310.04
5.1.40.0070.04310.01
5.1.30.0030.06310.36
5.1.20.0000.06010.39
5.1.10.0000.06310.00
5.1.00.0100.03710.11
5.0.50.0070.0478.48
5.0.40.0070.0308.20
5.0.30.0030.0678.20
5.0.20.0030.0338.19
5.0.10.0070.0408.25
5.0.00.0070.0478.20
4.4.90.0000.0237.55
4.4.80.0030.0307.55
4.4.70.0070.0177.55
4.4.60.0000.0307.55
4.4.50.0000.0337.55
4.4.40.0030.0377.55
4.4.30.0000.0377.55
4.4.20.0030.0377.55
4.4.10.0070.0307.55
4.4.00.0100.0407.55
4.3.110.0000.0377.55
4.3.100.0000.0377.55
4.3.90.0000.0377.55
4.3.80.0030.0437.55
4.3.70.0030.0307.55
4.3.60.0070.0307.55
4.3.50.0070.0307.55
4.3.40.0070.0507.55
4.3.30.0000.0407.55
4.3.20.0030.0307.55
4.3.10.0030.0337.55
4.3.00.0030.0237.55

preferences:
47.17 ms | 401 KiB | 5 Q