3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reKey($oldArray, $value, $newArray=Array()) { if (count($oldArray)) { $currentValue = current($oldArray); unset($oldArray[key($oldArray)]); $newArray[$currentValue] = Array(); print_r($newArray); $newArray = reKey($oldArray, $value, $newArray[$currentValue]); } else{ $newArray[key($newArray)] = $value; } return $newArray; } $array = Array( 0 => "this", 1 => "that", 2 => "those", 3 => "they", ); $newArray = reKey($array, "asdadsad", Array()); print_r($newArray);

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.0100.00318.43
8.3.50.0090.00918.19
8.3.40.0170.00018.89
8.3.30.0100.00718.67
8.3.20.0000.00820.38
8.3.10.0050.00320.36
8.3.00.0000.00820.64
8.2.180.0040.01118.34
8.2.170.0150.00722.96
8.2.160.0070.01320.41
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00419.23
8.2.120.0050.00326.35
8.2.110.0030.00621.06
8.2.100.0090.00317.80
8.2.90.0040.00419.23
8.2.80.0050.00317.97
8.2.70.0030.00617.50
8.2.60.0030.00618.04
8.2.50.0060.00318.09
8.2.40.0000.00720.42
8.2.30.0040.00419.50
8.2.20.0040.00417.76
8.2.10.0070.00018.07
8.2.00.0040.00418.17
8.1.280.0120.00325.92
8.1.270.0050.00323.96
8.1.260.0140.00028.09
8.1.250.0000.00828.09
8.1.240.0030.00622.11
8.1.230.0060.00617.70
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.25
8.1.190.0050.00317.22
8.1.180.0000.00918.10
8.1.170.0000.00818.59
8.1.160.0030.00320.89
8.1.150.0020.00518.88
8.1.140.0050.00319.54
8.1.130.0040.00417.56
8.1.120.0000.00717.43
8.1.110.0040.00417.50
8.1.100.0030.00517.37
8.1.90.0000.00817.42
8.1.80.0000.00817.49
8.1.70.0000.00917.42
8.1.60.0000.00817.56
8.1.50.0030.00617.48
8.1.40.0040.00417.41
8.1.30.0040.00417.68
8.1.20.0080.00017.50
8.1.10.0000.00717.54
8.1.00.0000.00817.32
8.0.300.0040.00418.77
8.0.290.0000.00816.63
8.0.280.0030.00318.28
8.0.270.0000.00817.20
8.0.260.0060.00017.13
8.0.250.0000.00716.86
8.0.240.0000.00816.76
8.0.230.0040.00416.89
8.0.220.0040.00416.72
8.0.210.0040.00416.82
8.0.200.0060.00016.89
8.0.190.0050.00316.95
8.0.180.0040.00416.83
8.0.170.0070.00016.86
8.0.160.0000.00716.93
8.0.150.0030.00316.81
8.0.140.0030.00316.87
8.0.130.0050.00013.34
8.0.120.0000.00816.84
8.0.110.0080.00016.81
8.0.100.0040.00416.79
8.0.90.0070.00016.84
8.0.80.0100.00416.84
8.0.70.0000.00716.94
8.0.60.0070.00316.67
8.0.50.0040.00416.71
8.0.30.0050.01616.97
8.0.20.0070.01117.40
8.0.10.0050.00216.97
8.0.00.0130.00716.68
7.4.330.0020.00216.79
7.4.320.0040.00416.60
7.4.300.0030.00316.61
7.4.290.0030.00316.52
7.4.280.0040.00416.59
7.4.270.0030.00316.57
7.4.260.0030.00316.50
7.4.250.0040.00416.54
7.4.240.0000.00716.57
7.4.230.0030.00316.60
7.4.220.0080.00816.63
7.4.210.0100.00516.68
7.4.200.0000.00816.53
7.4.160.0060.01016.60
7.4.150.0060.01117.40
7.4.140.0160.01217.86
7.4.130.0080.01116.55
7.4.120.0110.00616.52
7.4.110.0100.00716.48
7.4.100.0080.01516.36
7.4.90.0130.01016.30
7.4.80.0100.01019.39
7.4.70.0220.00016.38
7.4.60.0070.01016.43
7.4.50.0060.00916.47
7.4.40.0110.00716.43
7.4.30.0090.01216.43
7.4.00.0100.00314.91
7.3.330.0060.00013.34
7.3.320.0000.00513.23
7.3.310.0060.00016.23
7.3.300.0000.00716.23
7.3.290.0000.00716.31
7.3.280.0050.01316.37
7.3.270.0120.00617.40
7.3.260.0170.00716.27
7.3.250.0100.00716.57
7.3.240.0130.00516.32
7.3.230.0120.00416.61
7.3.210.0170.00016.55
7.3.200.0160.00016.70
7.3.190.0340.02116.23
7.3.180.0100.00616.26
7.3.170.0090.01316.50
7.3.160.0130.00316.46
7.2.330.0130.00416.39
7.2.320.0140.00516.70
7.2.310.0000.01716.86
7.2.300.0210.00016.71
7.2.290.0090.00616.73
7.2.80.0080.00316.67
7.2.60.0070.00316.97
7.2.00.0040.01119.30
7.1.200.0050.00215.61
7.1.100.0030.00917.92
7.1.70.0040.00417.21
7.1.60.0140.01019.19
7.1.00.0100.06022.51
7.0.200.0210.00714.86
7.0.60.0270.07320.00
7.0.50.0100.03317.88
7.0.40.0070.05320.13
7.0.30.0200.06020.24
7.0.20.0300.07320.23
7.0.10.0070.05020.07
7.0.00.0030.09020.24
5.6.280.0030.09321.13
5.6.210.0030.08320.47
5.6.200.0000.05718.29
5.6.190.0100.08720.61
5.6.180.0130.04320.50
5.6.170.0300.06320.55
5.6.160.0070.08320.50
5.6.150.0030.04018.12
5.6.140.0070.04318.18
5.6.130.0170.07318.18
5.6.120.0070.04021.05
5.6.110.0070.08321.02
5.6.100.0030.04321.03
5.6.90.0000.07320.96
5.6.80.0030.06020.53
5.5.350.0170.05020.50
5.5.340.0070.05017.93
5.5.330.0070.04020.35
5.5.320.0300.08020.27
5.5.310.0170.04020.35
5.5.300.0070.07017.95
5.5.290.0030.04718.05
5.5.280.0070.05320.65
5.5.270.0030.08720.86
5.5.260.0100.04720.73
5.5.250.0070.04020.75
5.5.240.4270.04020.34

preferences:
65.38 ms | 401 KiB | 5 Q