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); $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.0070.01116.99
8.3.50.0130.00722.17
8.3.40.0090.00619.17
8.3.30.0070.00719.41
8.3.20.0000.00820.55
8.3.10.0080.00023.90
8.3.00.0000.00820.94
8.2.180.0130.01016.88
8.2.170.0040.01222.96
8.2.160.0100.01022.39
8.2.150.0030.00624.18
8.2.140.0030.00624.66
8.2.130.0000.00926.16
8.2.120.0050.00322.47
8.2.110.0090.00019.54
8.2.100.0110.00018.09
8.2.90.0000.00819.42
8.2.80.0030.00618.18
8.2.70.0060.00317.88
8.2.60.0050.00318.18
8.2.50.0060.00318.07
8.2.40.0030.00619.66
8.2.30.0070.00018.45
8.2.20.0030.00618.04
8.2.10.0000.00818.07
8.2.00.0040.00418.16
8.1.280.0040.01125.92
8.1.270.0000.00824.04
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00322.98
8.1.230.0000.01119.41
8.1.220.0040.00418.03
8.1.210.0050.00318.77
8.1.200.0060.00317.60
8.1.190.0030.00517.90
8.1.180.0000.00818.10
8.1.170.0000.00818.84
8.1.160.0000.00822.28
8.1.150.0000.00818.95
8.1.140.0030.00617.71
8.1.130.0000.00718.10
8.1.120.0000.00717.70
8.1.110.0000.00717.81
8.1.100.0040.00417.78
8.1.90.0020.00517.77
8.1.80.0030.00317.70
8.1.70.0040.00417.80
8.1.60.0030.00617.87
8.1.50.0000.00817.86
8.1.40.0090.00017.72
8.1.30.0000.00817.90
8.1.20.0030.00617.89
8.1.10.0040.00417.82
8.1.00.0040.00417.72
8.0.300.0070.00018.77
8.0.290.0050.00217.55
8.0.280.0030.00518.71
8.0.270.0030.00317.46
8.0.260.0080.00017.17
8.0.250.0000.00717.19
8.0.240.0030.00517.33
8.0.230.0050.00217.21
8.0.220.0020.00517.20
8.0.210.0030.00317.33
8.0.200.0030.00517.31
8.0.190.0040.00417.32
8.0.180.0040.00417.37
8.0.170.0000.00817.11
8.0.160.0040.00417.25
8.0.150.0000.00817.14
8.0.140.0040.00417.32
8.0.130.0030.00313.72
8.0.120.0040.00417.25
8.0.110.0060.00317.35
8.0.100.0040.00417.28
8.0.90.0000.00717.19
8.0.80.0130.00317.28
8.0.70.0040.00416.99
8.0.60.0050.00317.32
8.0.50.0050.00316.98
8.0.30.0110.01517.36
8.0.20.0120.00817.55
8.0.10.0050.00217.37
8.0.00.0100.00817.06
7.4.330.0050.00015.38
7.4.320.0030.00316.80
7.4.300.0030.00316.83
7.4.290.0070.00016.79
7.4.280.0030.00316.70
7.4.270.0030.00616.91
7.4.260.0050.00216.82
7.4.250.0040.00416.89
7.4.240.0050.00316.88
7.4.230.0040.00416.78
7.4.220.0030.01716.75
7.4.210.0090.00716.83
7.4.200.0000.00816.70
7.4.190.0030.00316.77
7.4.160.0050.01416.67
7.4.150.0100.01717.40
7.4.140.0100.00817.86
7.4.130.0110.00816.93
7.4.120.0060.01416.93
7.4.110.0140.00516.86
7.4.100.0040.01517.04
7.4.90.0000.02016.98
7.4.80.0130.00616.83
7.4.70.0120.00616.77
7.4.60.0140.00516.80
7.4.50.0030.00616.84
7.4.40.0030.01122.77
7.4.30.0060.01317.07
7.4.00.0030.00915.13
7.3.330.0030.00313.71
7.3.320.0000.00613.60
7.3.310.0040.00416.72
7.3.300.0000.00716.53
7.3.290.0120.00916.70
7.3.280.0090.00716.74
7.3.270.0150.00417.40
7.3.260.0130.00616.71
7.3.250.0040.01516.99
7.3.240.0150.00316.82
7.3.230.0140.00316.82
7.3.210.0100.01016.80
7.3.200.0100.01319.39
7.3.190.0120.01216.90
7.3.180.0120.00616.75
7.3.170.0130.01016.81
7.3.160.0180.00316.79
7.3.120.0080.00514.92
7.2.330.0130.00616.94
7.2.320.0130.01017.02
7.2.310.0190.00017.13
7.2.300.0100.00717.14
7.2.290.0030.01417.04
7.2.60.0000.01416.97
7.2.00.0040.01119.54
7.1.200.0040.00815.84
7.1.100.0110.01118.16
7.1.70.0040.00417.23
7.1.60.0130.01319.29
7.1.50.0170.00717.11
7.1.00.0000.07722.64
7.0.200.0030.00517.10
7.0.140.0030.07722.13
7.0.120.0030.08722.09
7.0.110.0100.07321.97
7.0.100.0000.06022.08
7.0.90.0030.08722.18
7.0.80.0000.07022.13
7.0.70.0100.05022.27
7.0.60.0130.07722.27
7.0.50.0100.07322.07
7.0.40.0070.08020.22
7.0.30.0100.07720.18
7.0.20.0100.07020.17
7.0.10.0130.04320.20
7.0.00.0100.07720.10
5.6.280.0030.07020.91
5.6.270.0000.08321.11
5.6.260.0070.05320.99
5.6.250.0030.04021.24
5.6.240.0070.08720.95
5.6.230.0030.05020.96
5.6.220.0070.08320.91
5.6.210.0070.08321.04
5.6.200.0070.04021.17
5.6.190.0070.08721.09
5.6.180.0030.05721.06
5.6.170.0070.04021.01
5.6.160.0030.08320.97
5.6.150.0070.08321.06
5.6.140.0130.04020.93
5.6.130.0070.06720.88
5.6.120.0130.07721.22
5.6.110.0130.07020.99
5.6.100.0100.05720.95
5.6.90.0100.07021.01
5.6.80.0070.04720.35
5.6.70.0000.03720.29
5.6.60.0000.03720.28
5.6.50.0030.06320.27
5.6.40.0030.04020.34
5.6.30.0000.05020.53
5.6.20.0030.04020.24
5.6.10.0000.04320.41
5.6.00.0000.04320.47
5.5.380.0030.07017.58
5.5.370.0030.07717.59
5.5.360.0130.04017.63
5.5.350.0070.07717.64
5.5.340.0100.07318.21
5.5.330.0070.06018.24
5.5.320.0130.04018.45
5.5.310.0030.06018.00
5.5.300.0070.07318.03
5.5.290.0030.08017.90
5.5.280.0030.07718.00
5.5.270.0170.07018.17
5.5.260.0070.08018.19
5.5.250.0130.05318.08
5.5.240.0030.03017.55
5.5.230.0000.04717.54
5.5.220.0000.03717.67
5.5.210.0130.02717.54
5.5.200.0100.07017.63
5.5.190.0030.04317.35
5.5.180.0030.03317.52
5.5.160.0100.05717.72
5.5.150.0030.03717.61
5.5.140.0070.07717.38
5.5.130.0070.07717.32
5.5.120.0100.04017.47
5.5.110.0030.04717.64
5.5.100.0000.04017.71
5.5.90.0100.06317.52
5.5.80.0000.08317.25
5.5.70.0070.07717.24
5.5.60.0070.05017.45
5.5.50.0070.04017.27
5.5.40.0070.06317.36
5.5.30.0100.06317.14
5.5.20.0070.04717.24
5.5.10.0000.04017.36
5.5.00.0030.04717.21
5.4.450.0070.07719.65
5.4.440.0170.07019.48
5.4.430.0070.08319.30
5.4.420.0100.06719.48
5.4.410.0070.03719.58
5.4.400.0070.02719.30
5.4.390.0030.03719.17
5.4.380.0100.05019.00
5.4.370.0070.03319.18
5.4.360.0030.05019.32
5.4.350.0070.03719.16
5.4.340.0030.03719.34
5.4.320.0070.04019.38
5.4.310.0030.07319.02
5.4.300.0100.05319.16
5.4.290.0070.06319.38
5.4.280.0070.03719.33
5.4.270.0030.06019.16
5.4.260.0070.03318.97
5.4.250.0030.03719.15
5.4.240.0030.08019.15
5.4.230.0170.06719.37
5.4.220.0070.07719.11
5.4.210.0030.03719.01
5.4.200.0130.06018.93
5.4.190.0000.04018.96
5.4.180.0100.03019.33
5.4.170.0030.04019.30
5.4.160.0170.06319.16
5.4.150.0100.07319.36
5.4.140.0070.04316.46
5.4.130.0030.07016.59
5.4.120.0100.06016.75
5.4.110.0070.05716.68
5.4.100.0030.05316.43
5.4.90.0030.04316.73
5.4.80.0000.07016.51
5.4.70.0000.05316.42
5.4.60.0030.05716.63
5.4.50.0130.04316.64
5.4.40.0030.04716.62
5.4.30.0030.07016.68
5.4.20.0170.05316.61
5.4.10.0030.06716.68
5.4.00.0130.06316.19
5.3.290.0070.03014.66
5.3.280.0070.07014.48
5.3.270.0070.07014.47
5.3.260.0130.07014.68
5.3.250.0070.03314.45
5.3.240.0100.05714.48
5.3.230.0070.07314.67
5.3.220.0170.06314.44
5.3.210.0070.04714.50
5.3.200.0130.07314.40
5.3.190.0070.08014.42
5.3.180.0000.03714.51
5.3.170.0030.07014.41
5.3.160.0070.05714.49
5.3.150.0030.06014.41
5.3.140.0100.06714.50
5.3.130.0100.05714.43
5.3.120.0130.07014.45
5.3.110.0200.06714.44
5.3.100.0030.08013.98
5.3.90.0030.04714.04
5.3.80.0030.07313.80
5.3.70.0000.08313.86
5.3.60.0100.06313.79
5.3.50.0030.07713.82
5.3.40.0000.03713.81
5.3.30.0030.07013.84
5.3.20.0130.03313.53
5.3.10.0000.07013.45
5.3.00.0030.03313.52
5.2.170.0030.02711.10
5.2.160.0030.03311.07
5.2.150.0070.03710.93
5.2.140.0030.05311.03
5.2.130.0070.04311.04
5.2.120.0000.06011.04
5.2.110.0000.06311.11
5.2.100.0070.06011.10
5.2.90.0000.03011.09
5.2.80.0130.05011.03
5.2.70.0030.02711.15
5.2.60.0100.04010.84
5.2.50.0070.06011.04
5.2.40.0070.02710.93
5.2.30.0070.02311.13
5.2.20.0030.04010.84
5.2.10.0000.03010.77
5.2.00.0000.03310.61
5.1.60.0030.0209.91
5.1.50.0000.02710.07
5.1.40.0030.0479.88
5.1.30.0000.05010.41
5.1.20.0000.06010.58
5.1.10.0030.02710.01
5.1.00.0030.04710.08
5.0.50.0070.0209.86
5.0.40.0030.0179.86
5.0.30.0030.0279.86
5.0.20.0000.0209.86
5.0.10.0030.0239.86
5.0.00.0000.0309.86
4.4.90.0030.0239.86
4.4.80.0000.0309.86
4.4.70.0000.0139.86
4.4.60.0030.0179.86
4.4.50.0000.0139.86
4.4.40.0000.0239.86
4.4.30.0000.0139.86
4.4.20.0000.0379.86
4.4.10.0000.0239.86
4.4.00.0030.0209.86
4.3.110.0000.0139.86
4.3.100.0000.0139.86
4.3.90.0000.0209.86
4.3.80.0000.0239.86
4.3.70.0030.0179.86
4.3.60.0000.0139.86
4.3.50.0030.0109.86
4.3.40.0030.0209.86
4.3.30.0000.0239.86
4.3.20.0030.0279.86
4.3.10.0000.0209.86
4.3.00.0030.0139.86

preferences:
44.43 ms | 400 KiB | 5 Q