3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <translations> <translation id="title"> <english name="name1" ad="ad1">Hello there, how are you?</english> <italian name="name2" ad="ad2">Ciao, come stai?</italian> </translation> <translation id="text2"> <english name="name3" ad="ad4">222Hello there, how are you?</english> <italian name="name3" ad="ad4">222Ciao, come stai?</italian> </translation> <translation id="text3"> <english name="name5" ad="ad5">333Hello there, how are you?</english> <italian name="name6" ad="ad6">333Ciao, come stai?</italian> </translation> </translations>'; $xml = new SimpleXMLElement($xml); $xml = $xml->translation; //echo $xml->translation->english['ad'].PHP_EOL; //echo $xml->translation['id']->italian['name']; function translate($xml, $id, $lang) { foreach ($xml as $element) { if($element['id'] == $id) { return $element->children()['italian']; //foreach($element as $key => $val) { // echo $element['id']."{$key}: {$val}".PHP_EOL; //} } } } var_dump(translate($xml, 'text2', 'italian'));

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.40.0130.00919.09
8.3.30.0140.00019.11
8.3.20.0040.00420.55
8.3.10.0090.00023.90
8.3.00.0060.00319.63
8.2.170.0110.00422.96
8.2.160.0140.00020.64
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00422.28
8.2.110.0030.00721.36
8.2.100.0060.00617.97
8.2.90.0050.00319.47
8.2.80.0080.00017.97
8.2.70.0040.00417.75
8.2.60.0000.00818.18
8.2.50.0000.00818.10
8.2.40.0080.00020.20
8.2.30.0000.00718.29
8.2.20.0070.00017.97
8.2.10.0040.00418.46
8.2.00.0070.00017.86
8.1.270.0070.00022.32
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0070.00321.54
8.1.230.0060.00618.02
8.1.220.0000.00918.04
8.1.210.0000.00918.77
8.1.200.0030.00617.50
8.1.190.0040.00417.47
8.1.180.0040.00418.10
8.1.170.0000.00718.78
8.1.160.0000.00722.23
8.1.150.0040.00419.07
8.1.140.0000.00717.63
8.1.130.0070.00018.05
8.1.120.0050.00217.76
8.1.110.0060.00317.72
8.1.100.0020.00517.62
8.1.90.0050.00317.75
8.1.80.0000.00717.57
8.1.70.0030.00317.58
8.1.60.0030.00617.84
8.1.50.0060.00317.74
8.1.40.0000.00917.66
8.1.30.0000.00817.92
8.1.20.0030.00517.80
8.1.10.0000.00817.84
8.1.00.0000.00817.64
8.0.300.0040.00418.77
8.0.290.0030.00516.88
8.0.280.0050.00318.57
8.0.270.0040.00417.41
8.0.260.0030.00317.43
8.0.250.0030.00317.21
8.0.240.0030.00317.07
8.0.230.0000.00717.22
8.0.220.0040.00417.14
8.0.210.0000.00717.14
8.0.200.0060.00017.04
8.0.190.0030.00617.02
8.0.180.0000.00817.19
8.0.170.0040.00417.16
8.0.160.0050.00317.19
8.0.150.0040.00316.95
8.0.140.0040.00417.14
8.0.130.0060.00013.46
8.0.120.0030.00517.02
8.0.110.0080.00017.14
8.0.100.0040.00417.14
8.0.90.0070.00016.99
8.0.80.0130.00317.15
8.0.70.0040.00416.98
8.0.60.0060.00317.14
8.0.50.0040.00416.96
8.0.30.0100.01217.11
8.0.20.0100.01417.44
8.0.10.0080.00017.16
8.0.00.0030.01417.09
7.4.330.0050.00015.25
7.4.320.0030.00316.80
7.4.300.0000.00616.80
7.4.290.0000.00716.66
7.4.280.0000.00716.84
7.4.270.0040.00416.83
7.4.260.0030.00316.65
7.4.250.0040.00416.81
7.4.240.0030.00516.86
7.4.230.0000.00716.91
7.4.220.0190.00316.78
7.4.210.0060.00916.61
7.4.200.0070.00016.83
7.4.160.0040.01116.54
7.4.150.0140.00717.40
7.4.140.0090.01017.86
7.4.130.0100.00916.81
7.4.120.0050.01216.78
7.4.110.0140.00316.72
7.4.100.0030.01516.81
7.4.90.0070.01016.56
7.4.80.0140.00319.39
7.4.70.0070.01416.68
7.4.60.0090.00916.65
7.4.50.0030.00316.83
7.4.40.0170.00316.52
7.4.30.0070.01116.55
7.4.10.0050.01014.83
7.4.00.0060.01015.00
7.3.330.0000.00513.52
7.3.320.0000.00513.35
7.3.310.0000.00716.46
7.3.300.0000.00716.46
7.3.290.0070.00916.57
7.3.280.0120.00716.54
7.3.270.0090.00917.40
7.3.260.0120.00616.66
7.3.250.0060.01016.76
7.3.240.0090.00916.88
7.3.230.0030.01416.54
7.3.210.0100.00716.49
7.3.200.0060.01619.39
7.3.190.0090.01216.57
7.3.180.0070.01016.73
7.3.170.0130.00716.84
7.3.160.0160.00016.69
7.3.130.0080.01015.16
7.3.120.0080.01115.07
7.3.110.0100.00714.93
7.3.100.0080.00814.92
7.3.90.0060.01014.94
7.3.80.0050.00714.93
7.3.70.0070.00615.04
7.3.60.0060.00714.92
7.3.50.0030.00915.04
7.3.40.0070.00714.92
7.3.30.0020.01314.90
7.3.20.0020.00916.60
7.3.10.0020.01116.68
7.3.00.0080.00616.68
7.2.330.0120.01216.77
7.2.320.0090.00917.04
7.2.310.0140.00517.10
7.2.300.0070.01016.95
7.2.290.0090.00917.00
7.2.260.0070.01215.21
7.2.250.0050.01315.08
7.2.240.0070.00915.10
7.2.230.0080.00815.43
7.2.220.0020.01415.35
7.2.210.0050.00915.30
7.2.200.0070.00715.18
7.2.190.0030.01115.20
7.2.180.0060.00515.08
7.2.170.0050.01115.23
7.2.160.0080.00715.21
7.2.150.0070.00717.14
7.2.140.0080.00517.05
7.2.130.0040.00717.00
7.2.120.0080.00716.81
7.2.110.0060.00917.11
7.2.100.0030.00817.02
7.2.90.0040.01117.12
7.2.80.0080.00517.02
7.2.70.0040.00917.09
7.2.60.0040.01017.02
7.2.50.0060.00917.18
7.2.40.0080.00517.19
7.2.30.0070.00417.08
7.2.20.0030.01217.04
7.2.10.0080.00917.00
7.2.00.0040.01217.10
7.1.330.0060.00815.79
7.1.320.0050.00816.01
7.1.310.0030.01115.97
7.1.300.0040.00915.76
7.1.290.0110.00115.99
7.1.280.0040.01115.88
7.1.270.0030.00815.93
7.1.260.0050.01015.83
7.1.250.0010.00815.78
7.1.240.0060.00815.98
7.1.230.0040.00915.97
7.1.220.0100.00515.89
7.1.210.0060.00915.91
7.1.200.0060.00816.00
7.1.190.0040.00616.07
7.1.180.0030.00915.91
7.1.170.0060.00615.86
7.1.160.0030.00915.91
7.1.150.0080.00315.91
7.1.140.0080.00815.86
7.1.130.0060.00915.95
7.1.120.0050.00715.98
7.1.110.0040.00816.00
7.1.100.0070.01215.75
7.1.90.0030.00915.91
7.1.80.0070.00615.91
7.1.70.0040.00816.42
7.1.60.0020.01217.03
7.1.50.0050.01016.29
7.1.40.0040.00715.80
7.1.30.0060.00816.03
7.1.20.0060.00615.88
7.1.10.0030.00615.93
7.1.00.0060.03018.01
7.0.330.0040.00615.48
7.0.320.0050.01015.44
7.0.310.0020.00915.64
7.0.300.0000.01315.46
7.0.290.0100.00515.53
7.0.280.0050.00915.51
7.0.270.0050.01015.56
7.0.260.0060.00515.60
7.0.250.0050.00915.47
7.0.240.0070.00715.46
7.0.230.0050.00915.68
7.0.220.0030.00815.47
7.0.210.0070.00715.52
7.0.200.0090.00515.93
7.0.190.0060.00715.42
7.0.180.0100.00515.48
7.0.170.0060.01015.62
7.0.160.0080.00515.50
7.0.150.0080.00615.57
7.0.140.0050.03017.72
7.0.130.0070.00515.45
7.0.120.0050.00715.63
7.0.110.0050.00815.39
7.0.100.0070.00515.64
7.0.90.0060.00815.56
7.0.80.0070.00715.64
7.0.70.0030.00815.44
7.0.60.0090.02916.96
7.0.50.0060.03116.39
7.0.40.0120.02915.82
7.0.30.0080.01915.81
7.0.20.0180.02815.92
7.0.10.0070.03415.80
7.0.00.0070.03115.80
5.6.400.0080.00714.56
5.6.390.0030.01314.58
5.6.380.0080.00714.60
5.6.370.0020.01014.49
5.6.360.0060.00814.55
5.6.350.0020.01114.68
5.6.340.0040.01114.51
5.6.330.0060.00614.32
5.6.320.0080.00914.44
5.6.310.0080.00514.50
5.6.300.0040.01014.46
5.6.290.0020.01014.50
5.6.280.0040.02916.74
5.6.270.0050.00814.54
5.6.260.0060.00814.59
5.6.250.0020.00814.59
5.6.240.0050.00914.48
5.6.230.0060.00814.48
5.6.220.0070.00514.38
5.6.210.0040.03116.50
5.6.200.0050.03115.74
5.6.190.0060.02516.55
5.6.180.0110.03316.45
5.6.170.0140.03116.47
5.6.160.0050.02616.41
5.6.150.0070.02215.65
5.6.140.0100.02215.80
5.6.130.0070.02315.83
5.6.120.0040.02616.67
5.6.110.0070.01916.72
5.6.100.0110.02916.60
5.6.90.0100.02716.65
5.6.80.0050.03516.44
5.6.70.1630.01716.53
5.6.60.0070.00814.34
5.6.50.0070.00514.42
5.6.40.0090.00714.30
5.6.30.0080.00514.78
5.6.20.0060.00414.46
5.6.10.0000.00914.37
5.6.00.0060.00514.41
5.5.380.0070.00714.37
5.5.370.0020.01114.63
5.5.360.0100.00514.38
5.5.350.0160.02416.43
5.5.340.0040.02815.65
5.5.330.0040.01916.28
5.5.320.0160.02016.64
5.5.310.0130.03216.40
5.5.300.0080.03115.66
5.5.290.0010.02415.71
5.5.280.0050.03416.57
5.5.270.0040.02416.68
5.5.260.0100.02116.53
5.5.250.0080.02816.54
5.5.240.0110.03216.35
5.5.230.0050.00714.40
5.5.220.0050.01014.40
5.5.210.0050.00514.45
5.5.200.0090.00514.48
5.5.190.0080.00514.02
5.5.180.0040.00714.43
5.5.170.0060.00314.33
5.5.160.0030.00714.45
5.5.150.0040.00714.23
5.5.140.0020.01014.35
5.5.130.0000.01214.34
5.5.120.0050.00514.23
5.5.110.0060.00614.34
5.5.100.0050.00514.47
5.5.90.0070.00614.32
5.5.80.0020.01314.44
5.5.70.0030.01014.55
5.5.60.0020.00914.44
5.5.50.0060.00714.35
5.5.40.0030.00914.39
5.5.30.0100.00514.51
5.5.20.0070.00614.20
5.5.10.0050.00814.40
5.5.00.0050.00714.28
5.4.450.0280.02313.96
5.4.440.0330.03114.02
5.4.430.0240.02414.02
5.4.420.0280.01713.99
5.4.410.0310.02613.93
5.4.400.0090.02013.74
5.4.390.0270.02413.81
5.4.380.0300.02113.79
5.4.370.0260.02313.90
5.4.360.0290.02213.95
5.4.350.0050.02013.89
5.4.340.0020.01511.41
5.4.330.0060.00111.15
5.4.320.0040.01811.50
5.4.310.0040.01511.66
5.4.300.0050.01511.82
5.4.290.0040.01711.70
5.4.280.0080.01311.47
5.4.270.0070.01311.65
5.4.260.0030.01711.57
5.4.250.0010.02111.68
5.4.240.0030.02211.64
5.4.230.0050.02111.67
5.4.220.0060.02011.60
5.4.210.0030.01811.61
5.4.200.0030.01911.61
5.4.190.0030.01911.70
5.4.180.0090.01411.68
5.4.170.0050.01511.54
5.4.160.0040.01611.54
5.4.150.0070.01511.43
5.4.140.0050.01611.51
5.4.130.0050.01511.38
5.4.120.0070.01611.49
5.4.110.0070.01411.59
5.4.100.0030.01611.34
5.4.90.0030.02011.37
5.4.80.0050.01511.42
5.4.70.0030.01711.62
5.4.60.0070.01411.51
5.4.50.0030.01911.47
5.4.40.0070.01611.56
5.4.30.0060.01611.51
5.4.20.0040.01811.56
5.4.10.0070.01711.50
5.4.00.0070.01411.25
5.3.290.0120.05112.80
5.3.280.0130.03412.71
5.3.270.0080.03912.72
5.3.260.0100.03612.72
5.3.250.0040.04012.72
5.3.240.0070.03612.72
5.3.230.0080.03812.71
5.3.220.0090.04012.68
5.3.210.0050.04112.68
5.3.200.0070.03712.68
5.3.190.0050.03912.68
5.3.180.0050.03812.67
5.3.170.0050.03712.67
5.3.160.0050.03812.68
5.3.150.0060.03812.67
5.3.140.0060.03712.66
5.3.130.0050.03912.66
5.3.120.0050.03912.66
5.3.110.0060.03812.65
5.3.100.0070.03612.12
5.3.90.0090.03312.10
5.3.80.0040.03812.10
5.3.70.0050.03712.09
5.3.60.0070.03512.08
5.3.50.0060.03512.04
5.3.40.0050.03712.03
5.3.30.0040.03611.99
5.3.20.0070.03311.77
5.3.10.0090.03111.73
5.3.00.0060.03511.72
5.2.170.0080.0279.23
5.2.160.0040.0299.23
5.2.150.0050.0309.23
5.2.140.0060.0299.22
5.2.130.0090.0259.18
5.2.120.0080.0259.18
5.2.110.0080.0279.19
5.2.100.0050.0299.18
5.2.90.0060.0349.18
5.2.80.0080.0319.18
5.2.70.0030.0319.18
5.2.60.0060.0289.13
5.2.50.0070.0279.10
5.2.40.0040.0289.08
5.2.30.0030.0319.05
5.2.20.0080.0259.04
5.2.10.0060.0258.95
5.2.00.0050.0288.82
5.1.60.0010.0278.10
5.1.50.0070.0218.10
5.1.40.0010.0278.07
5.1.30.0030.0268.42
5.1.20.0040.0268.45
5.1.10.0080.0228.18
5.1.00.0050.0268.18
5.0.50.0020.0226.64
5.0.40.0040.0186.51
5.0.30.0030.0316.32
5.0.20.0000.0236.29
5.0.10.0040.0286.27
5.0.00.0040.0336.26
4.4.90.0050.0134.78
4.4.80.0020.0164.76
4.4.70.0060.0124.75
4.4.60.0000.0194.75
4.4.50.0040.0134.77
4.4.40.0010.0264.71
4.4.30.0010.0174.76
4.4.20.0030.0154.85
4.4.10.0020.0164.85
4.4.00.0040.0244.76
4.3.110.0020.0174.67
4.3.100.0040.0134.66
4.3.90.0030.0144.63
4.3.80.0040.0234.59
4.3.70.0060.0124.63
4.3.60.0020.0164.62
4.3.50.0010.0174.63
4.3.40.0030.0244.53
4.3.30.0010.0173.30
4.3.20.0010.0183.28
4.3.10.0030.0173.24
4.3.00.0030.0306.92

preferences:
53.66 ms | 400 KiB | 5 Q