3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <translations> <translation id="id1"> <es>Español1</es> <en>English1</en> </translation> <translation id="id2"> <es>Español2</es> <en>English2</en> </translation> <translation id="id3"> <es>Español3</es> <en>English13</en> </translation> </translations>'; $xml = new SimpleXMLElement($xml); $xml = $xml->translation; function translate($xml, $id, $lang) { foreach ($xml as $element) { if($element['id'] == $id) { return $element->{$lang}; } } } echo translate($xml, 'id1', 'es'); echo translate($xml, 'id1', 'en'); echo translate($xml, 'id2', 'es'); echo translate($xml, 'id2', 'en'); echo translate($xml, 'id3', 'es'); echo translate($xml, 'id3', 'en');

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.0140.00318.56
8.3.50.0150.01421.32
8.3.40.0090.00618.74
8.3.30.0080.00819.34
8.3.20.0040.00420.49
8.3.10.0040.00423.64
8.3.00.0050.00319.63
8.2.180.0160.00316.75
8.2.170.0070.00722.96
8.2.160.0070.00720.62
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0080.00026.16
8.2.120.0090.00022.35
8.2.110.0050.00522.37
8.2.100.0110.00018.03
8.2.90.0040.00419.46
8.2.80.0030.00517.97
8.2.70.0060.00317.88
8.2.60.0040.00418.18
8.2.50.0060.00318.07
8.2.40.0040.00420.26
8.2.30.0040.00418.25
8.2.20.0040.00418.00
8.2.10.0070.00018.32
8.2.00.0000.00817.98
8.1.280.0100.00725.92
8.1.270.0030.00622.40
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0060.00320.80
8.1.230.0070.00417.77
8.1.220.0040.00417.89
8.1.210.0080.00018.77
8.1.200.0000.00917.48
8.1.190.0050.00317.36
8.1.180.0050.00318.10
8.1.170.0000.00818.78
8.1.160.0040.00422.25
8.1.150.0040.00419.13
8.1.140.0040.00417.59
8.1.130.0000.00717.96
8.1.120.0040.00417.62
8.1.110.0040.00417.59
8.1.100.0040.00417.66
8.1.90.0040.00417.61
8.1.80.0030.00317.74
8.1.70.0030.00317.72
8.1.60.0040.00417.71
8.1.50.0050.00317.70
8.1.40.0040.00417.69
8.1.30.0040.00417.75
8.1.20.0040.00417.91
8.1.10.0000.00817.72
8.1.00.0040.00417.60
8.0.300.0040.00418.77
8.0.290.0000.00717.00
8.0.280.0030.00318.68
8.0.270.0030.00317.49
8.0.260.0030.00317.45
8.0.250.0050.00317.23
8.0.240.0030.00317.21
8.0.230.0030.00617.21
8.0.220.0030.00317.20
8.0.210.0040.00417.15
8.0.200.0050.00217.16
8.0.190.0040.00417.04
8.0.180.0030.00517.08
8.0.170.0040.00417.00
8.0.160.0040.00417.11
8.0.150.0020.00517.05
8.0.140.0000.00816.95
8.0.130.0000.00613.51
8.0.120.0040.00416.96
8.0.110.0050.00317.03
8.0.100.0050.00317.21
8.0.90.0040.00416.95
8.0.80.0160.00017.07
8.0.70.0000.00816.99
8.0.60.0070.00016.98
8.0.50.0000.00817.01
8.0.30.0130.00817.40
8.0.20.0110.00917.41
8.0.10.0040.00417.25
8.0.00.0090.00917.15
7.4.330.0000.00515.25
7.4.320.0000.00616.73
7.4.300.0030.00316.84
7.4.290.0080.00016.86
7.4.280.0040.00416.74
7.4.270.0000.00716.83
7.4.260.0040.00416.81
7.4.250.0040.00416.81
7.4.240.0030.00516.80
7.4.230.0000.00716.75
7.4.220.0140.01416.92
7.4.210.0070.01416.73
7.4.200.0040.00416.86
7.4.160.0080.00816.84
7.4.150.0030.01617.40
7.4.140.0040.01417.86
7.4.130.0050.01216.87
7.4.120.0070.01516.86
7.4.110.0070.01016.77
7.4.100.0120.00616.73
7.4.90.0170.00016.76
7.4.80.0040.01319.39
7.4.70.0090.00916.78
7.4.60.0190.00616.91
7.4.50.0000.00616.71
7.4.40.0090.01216.80
7.4.30.0070.01016.72
7.4.00.0000.01615.23
7.3.330.0000.00613.36
7.3.320.0000.00613.60
7.3.310.0000.00716.59
7.3.300.0030.00316.48
7.3.290.0100.00716.58
7.3.280.0100.00816.53
7.3.270.0150.00317.40
7.3.260.0100.00716.65
7.3.250.0020.01416.58
7.3.240.0150.00316.76
7.3.230.0080.00816.65
7.3.210.0100.00616.87
7.3.200.0180.00019.39
7.3.190.0150.00616.84
7.3.180.0030.01416.52
7.3.170.0120.00316.72
7.3.160.0050.01116.64
7.2.330.0180.00016.78
7.2.320.0120.00616.93
7.2.310.0130.00716.97
7.2.300.0060.01317.04
7.2.290.0040.01516.75
7.2.60.0040.01116.87
7.2.00.0060.00619.83
7.1.200.0040.00815.67
7.1.100.0070.00718.14
7.1.70.0000.00717.47
7.1.60.0070.01819.11
7.1.50.0180.00716.76
7.1.00.0030.07322.51
7.0.200.0070.00716.91
7.0.140.0000.07722.17
7.0.60.0130.08020.10
7.0.50.0170.07017.86
7.0.40.0030.05320.50
7.0.30.0230.08320.20
7.0.20.0270.05320.20
7.0.10.0030.09020.29
7.0.00.0170.07020.32
5.6.280.0100.07021.04
5.6.210.0130.06720.71
5.6.200.0030.09318.30
5.6.190.0100.08320.60
5.6.180.0270.05320.71
5.6.170.0330.06020.79
5.6.160.0130.05020.57
5.6.150.0030.05018.20
5.6.140.0070.06718.32
5.6.130.0100.07318.29
5.6.120.0070.05021.04
5.6.110.0030.09321.09
5.6.100.0170.07721.16
5.6.90.0170.07321.01
5.6.80.0130.07720.57
5.6.70.3370.02720.59
5.5.350.0100.08720.45
5.5.340.0100.07718.08
5.5.330.0100.04020.55
5.5.320.0200.04020.49
5.5.310.0330.07020.42
5.5.300.0030.07017.99
5.5.290.0070.03718.09
5.5.280.0030.05320.81
5.5.270.0100.05020.81
5.5.260.0070.07320.94
5.5.250.0200.06320.83
5.5.240.0300.07020.41
5.4.450.0730.06319.69
5.4.440.0600.06019.53
5.4.430.0630.05319.52
5.4.420.0430.06319.74
5.4.410.0730.04719.28
5.4.400.0800.06019.36
5.4.390.0970.07719.04
5.4.380.0870.05719.03
5.4.370.0700.05719.21
5.4.360.0800.06019.20
5.4.350.0870.06019.20
5.4.340.0080.03912.17
5.4.320.0090.03312.65
5.4.310.0060.04012.65
5.4.300.0050.03912.65
5.4.290.0070.03612.65
5.4.280.0040.03912.55
5.4.270.0070.03712.56
5.4.260.0070.03612.55
5.4.250.0100.03512.56
5.4.240.0070.03512.55
5.4.230.0060.03712.55
5.4.220.0060.03612.55
5.4.210.0060.03812.55
5.4.200.0060.04712.55
5.4.190.0060.03612.54
5.4.180.0050.03612.54
5.4.170.0050.03712.55
5.4.160.0080.03412.55
5.4.150.0050.04312.54
5.4.140.0090.03612.23
5.4.130.0070.03412.22
5.4.120.0090.03812.17
5.4.110.0090.03212.18
5.4.100.0050.03712.17
5.4.90.0090.04212.17
5.4.80.0050.04012.17
5.4.70.0040.03812.17
5.4.60.0060.03612.17
5.4.50.0080.03412.17
5.4.40.0050.03712.14
5.4.30.0070.03612.15
5.4.20.0080.03612.15
5.4.10.0050.03612.15
5.4.00.0080.03311.64
5.3.290.0080.03812.91
5.3.280.0060.03812.84
5.3.270.0060.03812.85
5.3.260.0060.04012.86
5.3.250.0060.03812.86
5.3.240.0080.03712.86
5.3.230.0090.03412.85
5.3.220.0070.03612.82
5.3.210.0070.03712.82
5.3.200.0030.03912.82
5.3.190.0090.03412.82
5.3.180.0060.03812.82
5.3.170.0060.03912.82
5.3.160.0080.03412.82
5.3.150.0040.03912.82
5.3.140.0050.03712.81
5.3.130.0070.04112.81
5.3.120.0090.03712.80
5.3.110.0040.04212.80
5.3.100.0050.03812.28
5.3.90.0100.03212.27
5.3.80.0020.04012.26
5.3.70.0110.03712.26
5.3.60.0070.04412.24
5.3.50.0090.04312.19
5.3.40.0060.03612.19
5.3.30.0070.03412.16
5.3.20.0050.03611.93
5.3.10.0080.03211.89
5.3.00.0050.04311.88
5.2.170.0090.0299.39
5.2.160.0080.0339.39
5.2.150.0050.0399.39
5.2.140.0020.0339.39
5.2.130.0050.0299.35
5.2.120.0050.0379.35
5.2.110.0090.0299.36
5.2.100.0030.0349.35
5.2.90.0070.0289.35
5.2.80.0070.0309.35
5.2.70.0050.0309.35
5.2.60.0050.0339.30
5.2.50.0050.0309.27
5.2.40.0060.0329.25
5.2.30.0040.0339.22
5.2.20.0070.0319.21
5.2.10.0050.0289.12
5.2.00.0060.0278.97
5.1.60.0070.0218.26
5.1.50.0050.0238.25
5.1.40.0090.0198.24
5.1.30.0120.0278.59
5.1.20.0050.0288.61
5.1.10.0050.0338.33
5.1.00.0040.0268.33
5.0.50.0040.0236.81
5.0.40.0030.0276.67
5.0.30.0030.0326.49
5.0.20.0030.0206.45
5.0.10.0040.0206.43
5.0.00.0090.0356.43
4.4.90.0040.0174.78
4.4.80.0040.0164.75
4.4.70.0020.0164.76
4.4.60.0040.0144.76
4.4.50.0030.0154.77
4.4.40.0020.0264.71
4.4.30.0050.0144.76
4.4.20.0010.0174.85
4.4.10.0020.0174.85
4.4.00.0030.0254.76
4.3.110.0030.0174.67
4.3.100.0020.0154.66
4.3.90.0020.0154.63
4.3.80.0050.0224.58
4.3.70.0030.0164.63
4.3.60.0030.0154.63
4.3.50.0030.0154.63
4.3.40.0030.0234.54
4.3.30.0030.0153.30
4.3.20.0040.0143.28
4.3.10.0010.0173.24
4.3.00.0170.0276.85

preferences:
71.94 ms | 401 KiB | 5 Q