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.60.0040.01118.93
8.3.50.0130.00621.27
8.3.40.0090.00618.96
8.3.30.0140.00718.95
8.3.20.0040.00419.14
8.3.10.0030.00620.91
8.3.00.0060.00319.63
8.2.180.0140.00717.00
8.2.170.0120.00922.96
8.2.160.0040.01122.42
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00926.16
8.2.120.0040.00420.04
8.2.110.0030.00621.31
8.2.100.0030.00918.09
8.2.90.0030.00619.39
8.2.80.0040.00418.30
8.2.70.0050.00317.75
8.2.60.0060.00318.18
8.2.50.0040.00418.07
8.2.40.0060.00318.47
8.2.30.0090.00020.04
8.2.20.0050.00217.95
8.2.10.0060.00318.07
8.2.00.0000.00718.07
8.1.280.0090.00925.92
8.1.270.0040.00423.99
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0100.00022.66
8.1.230.0040.00921.21
8.1.220.0060.00318.77
8.1.210.0030.00619.06
8.1.200.0070.00317.60
8.1.190.0030.00517.78
8.1.180.0040.00418.10
8.1.170.0040.00419.00
8.1.160.0040.00419.19
8.1.150.0000.00718.92
8.1.140.0040.00417.75
8.1.130.0000.00818.05
8.1.120.0040.00417.66
8.1.110.0080.00017.77
8.1.100.0050.00317.84
8.1.90.0080.00017.78
8.1.80.0000.00717.79
8.1.70.0000.00717.64
8.1.60.0080.00017.92
8.1.50.0040.00417.66
8.1.40.0100.00017.83
8.1.30.0030.00617.91
8.1.20.0040.00417.93
8.1.10.0050.00317.83
8.1.00.0060.00317.87
8.0.300.0040.00720.39
8.0.290.0000.00717.00
8.0.280.0040.00418.73
8.0.270.0000.00717.47
8.0.260.0000.00717.22
8.0.250.0040.00417.34
8.0.240.0040.00417.42
8.0.230.0000.00717.30
8.0.220.0030.00717.34
8.0.210.0040.00417.27
8.0.200.0050.00517.39
8.0.190.0070.00017.32
8.0.180.0000.00817.15
8.0.170.0030.00617.22
8.0.160.0040.00417.34
8.0.150.0050.00317.19
8.0.140.0060.00317.10
8.0.130.0060.00013.66
8.0.120.0070.00017.13
8.0.110.0000.00817.19
8.0.100.0080.00017.34
8.0.90.0070.00017.22
8.0.80.0100.01017.25
8.0.70.0070.00017.11
8.0.60.0040.00417.11
8.0.50.0000.00717.30
8.0.30.0120.00817.39
8.0.20.0110.00617.55
8.0.10.0040.00417.27
8.0.00.0070.01217.10
7.4.330.0020.00213.43
7.4.320.0070.00016.93
7.4.300.0070.00016.90
7.4.290.0070.00016.79
7.4.280.0030.00616.80
7.4.270.0000.00816.90
7.4.260.0000.00613.55
7.4.250.0030.00616.67
7.4.240.0070.00016.93
7.4.230.0000.00716.64
7.4.220.0030.01916.84
7.4.210.0060.01016.89
7.4.200.0000.00716.91
7.4.190.0000.00716.97
7.4.160.0100.01016.75
7.4.150.0070.01017.40
7.4.140.0100.01017.35
7.4.130.0050.01316.83
7.4.120.0060.01216.83
7.4.110.0120.01116.71
7.4.100.0030.02016.91
7.4.90.0100.01016.89
7.4.80.0150.00719.03
7.4.70.0120.00916.74
7.4.60.0140.00217.06
7.4.50.0040.00416.64
7.4.40.0060.00622.27
7.4.30.0090.00916.85
7.4.10.0030.01215.02
7.4.00.0030.01215.16
7.3.330.0000.00513.54
7.3.320.0000.00513.52
7.3.310.0030.00316.55
7.3.300.0030.00316.75
7.3.290.0110.00316.75
7.3.280.0100.00716.69
7.3.270.0150.00317.40
7.3.260.0130.00918.24
7.3.250.0100.01216.70
7.3.240.0090.00916.77
7.3.230.0130.00416.73
7.3.210.0030.01416.84
7.3.200.0120.00919.39
7.3.190.0120.00616.84
7.3.180.0130.01016.70
7.3.170.0070.01516.81
7.3.160.0060.00916.81
7.3.130.0110.00715.03
7.3.120.0090.00615.01
7.3.110.0080.00815.03
7.3.100.0090.00615.14
7.3.90.0050.00915.05
7.3.80.0020.01214.83
7.3.70.0040.01215.08
7.3.60.0050.00714.90
7.3.50.0030.00814.91
7.3.40.0100.00515.05
7.3.30.0050.00714.94
7.3.20.0050.00816.85
7.3.10.0010.01216.76
7.3.00.0060.00716.72
7.2.330.0060.01216.75
7.2.320.0110.00717.04
7.2.310.0150.00916.86
7.2.300.0070.01017.01
7.2.290.0160.00316.82
7.2.260.0150.00415.20
7.2.250.0070.01115.39
7.2.240.0030.00915.09
7.2.230.0030.01215.16
7.2.220.0000.01715.32
7.2.210.0100.00115.10
7.2.200.0100.00615.11
7.2.190.0030.01015.22
7.2.180.0070.00915.09
7.2.170.0060.01115.28
7.2.160.0050.00915.19
7.2.150.0030.00816.92
7.2.140.0040.01017.00
7.2.130.0060.00817.04
7.2.120.0040.00816.94
7.2.110.0070.00817.02
7.2.100.0090.00517.07
7.2.90.0070.00617.14
7.2.80.0050.00617.13
7.2.70.0020.01117.07
7.2.60.0080.00817.16
7.2.50.0050.00717.11
7.2.40.0040.01117.02
7.2.30.0070.00617.02
7.2.20.0060.00817.08
7.2.10.0060.00816.95
7.2.00.0070.00617.62
7.1.330.0110.00315.84
7.1.320.0020.01416.07
7.1.310.0070.00715.90
7.1.300.0040.00616.01
7.1.290.0000.01215.85
7.1.280.0070.00316.07
7.1.270.0050.00515.92
7.1.260.0010.01315.86
7.1.250.0090.00315.90
7.1.240.0060.00815.83
7.1.230.0040.01115.82
7.1.220.0050.00715.81
7.1.210.0040.00815.87
7.1.200.0040.00815.88
7.1.190.0080.00815.86
7.1.180.0040.01115.90
7.1.170.0070.00615.94
7.1.160.0080.00516.01
7.1.150.0020.01115.93
7.1.140.0060.00815.98
7.1.130.0030.01015.86
7.1.120.0020.00915.73
7.1.110.0020.01016.03
7.1.100.0040.00816.73
7.1.90.0080.00415.90
7.1.80.0050.00915.82
7.1.70.0070.00316.46
7.1.60.0070.01117.17
7.1.50.0070.00816.38
7.1.40.0050.00615.90
7.1.30.0020.01315.83
7.1.20.0050.00916.08
7.1.10.0060.00515.92
7.1.00.0060.02318.15
7.0.330.0020.00715.50
7.0.320.0050.00915.43
7.0.310.0040.00615.41
7.0.300.0040.00915.41
7.0.290.0060.00315.50
7.0.280.0070.00615.43
7.0.270.0060.00715.37
7.0.260.0030.01215.41
7.0.250.0070.00715.63
7.0.240.0070.00515.49
7.0.230.0030.00715.47
7.0.220.0030.00815.61
7.0.210.0060.00415.39
7.0.200.0120.00615.33
7.0.190.0040.00815.69
7.0.180.0050.00515.39
7.0.170.0020.01115.52
7.0.160.0050.00615.54
7.0.150.0060.00515.52
7.0.140.0060.02517.78
7.0.130.0030.01015.61
7.0.120.0050.00615.63
7.0.110.0060.00615.63
7.0.100.0040.00815.49
7.0.90.0050.00415.48
7.0.80.0090.00515.44
7.0.70.0080.00515.44
7.0.60.0110.03117.09
7.0.50.0090.01516.44
7.0.40.0060.02215.07
7.0.30.0060.01914.93
7.0.20.0030.01915.06
7.0.10.0020.02115.01
7.0.00.0040.01615.02
5.6.400.0040.00814.22
5.6.390.0070.00714.46
5.6.380.0050.00514.35
5.6.370.0050.00614.47
5.6.360.0060.00714.61
5.6.350.0040.00914.35
5.6.340.0090.00314.76
5.6.330.0030.00914.60
5.6.320.0020.01114.53
5.6.310.0050.00914.69
5.6.300.0030.00914.52
5.6.290.0050.00714.55
5.6.280.0060.02916.74
5.6.270.0020.01114.65
5.6.260.0060.00614.52
5.6.250.0080.00514.53
5.6.240.0030.00714.65
5.6.230.0040.01114.66
5.6.220.0050.00614.40
5.6.210.0060.03016.56
5.6.200.0040.01915.73
5.6.190.0110.01515.68
5.6.180.0020.02315.74
5.6.170.0070.01615.74
5.6.160.0030.02015.75
5.6.150.0060.01915.66
5.6.140.0060.01715.93
5.6.130.0020.02115.62
5.6.120.0020.02015.86
5.6.110.0040.01815.83
5.6.100.0050.01915.66
5.6.90.0050.01915.72
5.6.80.0060.02415.60
5.6.70.0050.03215.61
5.6.60.0120.02915.44
5.6.50.0080.02315.62
5.6.40.0040.03015.57
5.6.30.0060.03015.48
5.6.20.0080.03015.49
5.6.10.0040.02315.58
5.6.00.0080.02615.51
5.5.380.0070.00413.00
5.5.370.0100.00112.90
5.5.360.0080.00512.93
5.5.350.0030.03415.65
5.5.340.0020.02114.69
5.5.330.0060.01814.67
5.5.320.0050.01814.63
5.5.310.0060.01614.61
5.5.300.0040.01714.62
5.5.290.0040.01714.69
5.5.280.0040.01814.65
5.5.270.0020.02114.61
5.5.260.0010.02014.68
5.5.250.0060.02814.52
5.5.240.0050.02114.38
5.5.230.0060.02314.28
5.5.220.0050.03014.51
5.5.210.0060.03214.46
5.5.200.0080.01614.42
5.5.190.0060.02814.39
5.5.180.0080.02714.45
5.5.170.0050.00712.96
5.5.160.0040.03114.37
5.5.150.0080.02914.35
5.5.140.0030.02714.38
5.5.130.0090.02414.40
5.5.120.0080.01714.28
5.5.110.0070.02814.44
5.5.100.0070.02314.39
5.5.90.0070.02114.26
5.5.80.0070.01414.26
5.5.70.0040.01814.47
5.5.60.0060.02714.28
5.5.50.0030.03014.27
5.5.40.0030.03114.23
5.5.30.0060.03014.37
5.5.20.0010.03414.23
5.5.10.0050.02514.28
5.5.00.0060.01614.20
5.4.450.0020.01814.11
5.4.440.0040.01614.01
5.4.430.0040.01813.96
5.4.420.0040.01714.16
5.4.410.0080.02314.08
5.4.400.0050.02614.12
5.4.390.0070.02713.86
5.4.380.0030.02113.94
5.4.370.0060.02513.97
5.4.360.0040.02213.78
5.4.350.0070.03013.77
5.4.340.0010.02913.87
5.4.330.0010.00710.94
5.4.320.0040.03113.76
5.4.310.0050.02813.88
5.4.300.0060.01713.79
5.4.290.0050.01913.90
5.4.280.0050.02013.87
5.4.270.0030.03013.79
5.4.260.0050.02813.92
5.4.250.0070.02813.82
5.4.240.0090.02613.83
5.4.230.0080.01313.88
5.4.220.0050.02913.70
5.4.210.0030.03213.74
5.4.200.0060.03013.88
5.4.190.0020.03013.86
5.4.180.0080.01813.83
5.4.170.0060.01513.81
5.4.160.0020.02113.99
5.4.150.0070.03113.89
5.4.140.0060.02212.86
5.4.130.0060.02413.03
5.4.120.0050.02612.98
5.4.110.0050.02413.11
5.4.100.0040.02012.94
5.4.90.0050.01413.04
5.4.80.0030.02113.18
5.4.70.0070.02712.97
5.4.60.0060.01812.91
5.4.50.0040.02612.96
5.4.40.0070.02713.06
5.4.30.0050.03012.92
5.4.20.0020.02512.88
5.4.10.0030.03012.97
5.4.00.0050.02812.81
5.3.290.0060.02311.56
5.3.280.0040.01711.56
5.3.270.0040.01711.63
5.3.260.0050.02011.62
5.3.250.0020.03211.63
5.3.240.0030.01911.57
5.3.230.0020.02311.55
5.3.220.0020.02011.53
5.3.210.0020.01911.52
5.3.200.0020.02311.61
5.3.190.0030.01611.56
5.3.180.0010.02011.68
5.3.170.0010.02211.61
5.3.160.0030.02811.69
5.3.150.0080.01811.67
5.3.140.0040.02911.62
5.3.130.0050.01511.61
5.3.120.0060.02111.64
5.3.110.0040.01511.66
5.3.100.0040.02711.48
5.3.90.0010.03111.53
5.3.80.0030.02711.32
5.3.70.0040.01911.44
5.3.60.0030.01811.44
5.3.50.0080.02411.30
5.3.40.0020.03011.45
5.3.30.0050.02511.35
5.3.20.0070.02411.31
5.3.10.0030.02011.20
5.3.00.0090.02311.18
5.2.170.0050.03210.52
5.2.160.0060.03110.68
5.2.150.0030.03010.50
5.2.140.0020.02510.62
5.2.130.0080.02810.57
5.2.120.0050.01810.56
5.2.110.0020.02010.47
5.2.100.0020.02710.54
5.2.90.0000.03010.57
5.2.80.0000.02710.57
5.2.70.0050.03010.57
5.2.60.0030.02910.47
5.2.50.0000.03410.53
5.2.40.0030.03310.51
5.2.30.0050.02510.58
5.2.20.0020.01910.51
5.2.10.0070.02210.49
5.2.00.0030.03410.46
5.1.60.0010.01810.05
5.1.50.0050.02610.02
5.1.40.0030.01310.01
5.1.30.0050.01310.19
5.1.20.0050.01410.17
5.1.10.0020.01610.04
5.1.00.0030.02310.06
5.0.50.0020.0129.23
5.0.40.0020.0209.21
5.0.30.0000.0359.21
5.0.20.0030.0179.23
5.0.10.0020.0179.07
5.0.00.0040.0329.14
4.4.90.0020.0149.00
4.4.80.0000.0179.00
4.4.70.0000.0119.00
4.4.60.0070.0139.00
4.4.50.0020.0119.00
4.4.40.0050.0119.00
4.4.30.0000.0109.00
4.4.20.0050.0079.00
4.4.10.0030.0189.00
4.4.00.0010.0309.00
4.3.110.0030.0109.00
4.3.100.0030.0189.00
4.3.90.0020.0129.00
4.3.80.0040.0269.00
4.3.70.0050.0179.00
4.3.60.0000.0149.00
4.3.50.0020.0099.00
4.3.40.0020.0179.00
4.3.30.0000.0209.00
4.3.20.0020.0179.00
4.3.10.0020.0209.00
4.3.00.0030.0189.00

preferences:
47.06 ms | 401 KiB | 5 Q