3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getArrayFromHyphenArray($flatArray){ $deepArray = array(); foreach($flatArray as $key => $value){ $keysArray = explode('-', $key); $deepArray = $this->recursiveSet($deepArray, $keysArray, $value); } } function recursiveSet(&$array, $arg, $value){ if(empty($arg)){ $array = $value; return $array; } $key = array_shift($arg); if(!isset($array[$key])){ $array[$key] = array(); } return recursiveSet($array[$key],$arg,$value); } $arra = array('this-is-some' => 'value', 'this-is-second' => 'value'); print_r(getArrayFromHyphenArray($arra));

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.0170.00016.75
8.3.50.0070.01518.30
8.3.40.0120.00318.44
8.3.30.0070.01418.76
8.3.20.0040.00420.34
8.3.10.0000.00821.95
8.3.00.0030.00621.75
8.2.180.0030.01318.66
8.2.170.0110.00422.96
8.2.160.0140.00322.12
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00420.87
8.2.120.0080.00026.35
8.2.110.0100.00720.31
8.2.100.0090.00317.89
8.2.90.0050.00319.05
8.2.80.0050.00317.97
8.2.70.0000.00817.63
8.2.60.0080.00017.90
8.2.50.0050.00318.09
8.2.40.0070.00020.21
8.2.30.0030.00519.39
8.2.20.0040.00417.64
8.2.10.0070.00018.20
8.2.00.0040.00418.14
8.1.280.0110.00425.92
8.1.270.0040.00423.99
8.1.260.0060.00328.09
8.1.250.0040.00428.09
8.1.240.0030.00522.01
8.1.230.0070.00317.45
8.1.220.0040.00417.77
8.1.210.0030.00518.77
8.1.200.0000.01017.36
8.1.190.0030.00617.25
8.1.180.0080.00018.10
8.1.170.0040.00418.58
8.1.160.0050.00320.75
8.1.150.0000.00718.90
8.1.140.0080.00019.59
8.1.130.0000.00717.82
8.1.120.0040.00417.36
8.1.110.0000.00817.35
8.1.100.0050.00217.42
8.1.90.0050.00317.36
8.1.80.0040.00417.47
8.1.70.0030.00517.46
8.1.60.0000.00817.58
8.1.50.0080.00017.54
8.1.40.0040.00417.42
8.1.30.0000.00817.59
8.1.20.0000.00817.46
8.1.10.0040.00417.52
8.1.00.0040.00417.43
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.46
8.0.270.0030.00317.26
8.0.260.0000.00717.15
8.0.250.0030.00317.10
8.0.240.0050.00317.07
8.0.230.0040.00417.04
8.0.220.0030.00316.86
8.0.210.0000.00716.98
8.0.200.0040.00417.02
8.0.190.0000.00817.03
8.0.180.0040.00416.93
8.0.170.0050.00316.97
8.0.160.0070.00016.95
8.0.150.0040.00416.81
8.0.140.0030.00316.84
8.0.130.0000.00913.45
8.0.120.0040.00416.84
8.0.110.0040.00416.99
8.0.100.0000.00816.92
8.0.90.0000.00716.93
8.0.80.0120.00416.96
8.0.70.0000.00716.97
8.0.60.0040.00416.84
8.0.50.0000.00716.77
8.0.30.0100.00816.98
8.0.20.0120.01217.40
8.0.10.0070.00016.88
8.0.00.0070.01116.72
7.4.330.0050.00016.81
7.4.320.0000.00616.54
7.4.300.0030.00316.64
7.4.290.0040.00416.59
7.4.280.0030.00316.60
7.4.270.0030.00316.59
7.4.260.0000.00716.40
7.4.250.0040.00416.58
7.4.240.0070.00016.61
7.4.230.0000.00716.45
7.4.220.0060.01416.55
7.4.210.0030.01616.71
7.4.200.0000.00816.43
7.4.160.0150.00016.71
7.4.150.0140.01217.40
7.4.140.0100.01217.86
7.4.130.0130.00416.51
7.4.120.0100.00816.69
7.4.110.0120.00616.67
7.4.100.0140.00716.36
7.4.90.0070.01116.50
7.4.80.0090.01219.39
7.4.70.0070.01416.44
7.4.60.0100.00716.64
7.4.50.0060.00616.37
7.4.40.0130.01016.38
7.4.30.0130.00616.73
7.4.10.0040.01515.14
7.4.00.0090.00715.04
7.3.330.0000.00613.21
7.3.320.0080.00013.35
7.3.310.0070.00016.21
7.3.300.0060.00016.40
7.3.290.0050.01016.41
7.3.280.0080.01016.37
7.3.270.0090.00917.40
7.3.260.0060.01016.43
7.3.250.0110.00716.40
7.3.240.0080.01116.43
7.3.230.0090.00916.61
7.3.210.0090.00916.54
7.3.200.0140.00419.39
7.3.190.0150.00316.47
7.3.180.0130.00316.48
7.3.170.0030.01616.37
7.3.160.0100.00716.32
7.3.130.0100.00714.95
7.3.120.0060.01015.17
7.3.110.0090.00914.82
7.3.100.0100.00314.82
7.3.90.0030.01214.57
7.3.80.0000.00914.77
7.3.70.0040.00714.81
7.3.60.0070.00714.60
7.3.50.0030.01014.77
7.3.40.0030.01015.05
7.3.30.0000.01414.95
7.3.20.0070.00716.75
7.3.10.0080.00016.47
7.3.00.0050.00816.63
7.2.330.0120.00616.76
7.2.320.0090.00816.60
7.2.310.0060.00916.66
7.2.300.0100.00716.75
7.2.290.0070.01016.72
7.2.260.0080.00615.04
7.2.250.0100.01014.92
7.2.240.0070.00714.99
7.2.230.0000.01414.82
7.2.220.0060.00914.99
7.2.210.0030.01215.03
7.2.200.0050.00514.78
7.2.190.0020.01115.09
7.2.180.0120.00315.18
7.2.170.0040.00715.22
7.2.160.0000.01515.07
7.2.150.0060.00316.72
7.2.140.0040.01216.70
7.2.130.0070.00716.83
7.2.120.0020.00816.91
7.2.110.0080.00516.84
7.2.100.0100.00216.84
7.2.90.0090.00316.95
7.2.80.0070.00916.91
7.2.70.0070.00716.90
7.2.60.0030.00816.97
7.2.50.0060.00717.05
7.2.40.0030.00816.92
7.2.30.0060.00816.78
7.2.20.0050.00816.83
7.2.10.0060.00916.85
7.2.00.0010.01117.79
7.1.330.0070.00415.76
7.1.320.0050.00515.87
7.1.310.0070.00715.84
7.1.300.0090.00415.52
7.1.290.0030.00615.79
7.1.280.0040.00715.78
7.1.270.0000.01715.75
7.1.260.0070.00415.69
7.1.250.0050.00815.79
7.1.240.0020.01015.67
7.1.230.0050.00815.65
7.1.220.0030.01015.68
7.1.210.0060.00615.50
7.1.200.0060.00615.71
7.1.190.0040.00715.85
7.1.180.0020.00915.86
7.1.170.0020.01215.73
7.1.160.0070.00515.63
7.1.150.0060.00315.76
7.1.140.0060.00715.81
7.1.130.0050.00815.84
7.1.120.0030.01015.79
7.1.110.0120.00115.73
7.1.100.0130.00415.80
7.1.90.0090.00615.73
7.1.80.0050.00915.81
7.1.70.0050.00716.21
7.1.60.0060.01216.98
7.1.50.0060.01016.02
7.1.40.0060.00515.73
7.1.30.0050.00915.75
7.1.20.0060.00815.78
7.1.10.0050.01015.63
7.1.00.0020.03317.96
7.0.330.0040.00615.50
7.0.320.0050.00715.42
7.0.310.0040.01015.40
7.0.300.0030.01115.44
7.0.290.0020.01215.28
7.0.280.0050.00515.26
7.0.270.0030.00815.29
7.0.260.0040.00815.32
7.0.250.0050.00415.30
7.0.240.0030.00915.51
7.0.230.0070.00415.44
7.0.220.0060.00615.50
7.0.210.0050.00815.49
7.0.200.0680.00815.34
7.0.190.0070.00915.11
7.0.180.0020.01115.36
7.0.170.0050.00715.29
7.0.160.0020.01215.54
7.0.150.0020.00615.30
7.0.140.0050.00815.37
7.0.130.0030.00815.51
7.0.120.0040.00515.41
7.0.110.0020.01215.34
7.0.100.0050.00515.25
7.0.90.0060.00515.28
7.0.80.0060.00715.27
7.0.70.0020.00915.33
7.0.60.0120.02017.32
7.0.50.0040.02616.22
7.0.40.0070.02315.64
7.0.30.0160.02715.61
7.0.20.0110.03315.58
7.0.10.0060.02115.68
7.0.00.0050.03215.78
5.6.400.0030.01014.30
5.6.390.0000.01114.51
5.6.380.0050.00514.21
5.6.370.0080.00314.05
5.6.360.0020.01114.21
5.6.350.0030.00914.58
5.6.340.0040.00914.26
5.6.330.0060.00614.39
5.6.320.0050.00913.87
5.6.310.0040.00814.48
5.6.300.0060.00814.45
5.6.290.0020.01214.38
5.6.280.0060.02016.60
5.6.270.0030.01014.21
5.6.260.0050.00814.33
5.6.250.0040.01114.48
5.6.240.0030.01214.19
5.6.230.0050.00714.24
5.6.220.0070.00714.16
5.6.210.0060.01816.47
5.6.200.0110.02815.54
5.6.190.0060.02016.42
5.6.180.0130.02516.44
5.6.170.0130.03016.23
5.6.160.0060.03316.45
5.6.150.0050.03015.56
5.6.140.0060.03215.50
5.6.130.0060.02015.66
5.6.120.0060.02816.41
5.6.110.0080.03116.60
5.6.100.0060.03316.51
5.6.90.0090.02816.51
5.6.80.0080.03216.28
5.6.70.0020.01014.10
5.6.60.0060.01014.26
5.6.50.0060.00514.33
5.6.40.0020.01014.17
5.6.30.0030.01014.15
5.6.20.0090.00214.26
5.6.10.0050.01014.29
5.6.00.0040.00714.21
5.5.380.0070.00712.67
5.5.370.0090.00512.81
5.5.360.0080.00312.77
5.5.350.0100.03215.30
5.5.340.0050.02114.59
5.5.330.0030.02215.29
5.5.320.0120.01915.18
5.5.310.0120.02415.17
5.5.300.0040.03214.38
5.5.290.0040.01914.46
5.5.280.0100.02515.54
5.5.270.0030.02715.51
5.5.260.0070.02615.39
5.5.250.0070.02415.25
5.5.240.0100.02515.16
5.5.230.0080.00312.77
5.5.220.0060.00312.60
5.5.210.0030.00712.59
5.5.200.0050.00612.51
5.5.190.0030.00712.71
5.5.180.0060.00612.79
5.5.170.0070.00512.59
5.5.160.0020.00812.63
5.5.150.0070.00212.75
5.5.140.0050.00712.72
5.5.130.0040.00812.70
5.5.120.0070.00712.77
5.5.110.0050.00812.67
5.5.100.0050.00312.74
5.5.90.0020.00712.66
5.5.80.0030.00712.73
5.5.70.0030.00612.76
5.5.60.0040.00712.76
5.5.50.0020.00712.70
5.5.40.0020.00612.81
5.5.30.0040.00612.68
5.5.20.0080.00212.58
5.5.10.0060.00412.70
5.5.00.0020.00812.72

preferences:
57.35 ms | 400 KiB | 5 Q