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); return $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.0110.00318.43
8.3.50.0110.00721.99
8.3.40.0110.00418.67
8.3.30.0070.01118.84
8.3.20.0070.00020.34
8.3.10.0040.00420.52
8.3.00.0080.00020.64
8.2.180.0130.01018.51
8.2.170.0030.01222.96
8.2.160.0140.00020.35
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0000.00919.13
8.2.120.0070.00026.35
8.2.110.0030.00620.47
8.2.100.0070.00417.93
8.2.90.0000.00819.21
8.2.80.0080.00017.97
8.2.70.0030.00517.37
8.2.60.0030.00517.93
8.2.50.0000.00918.09
8.2.40.0050.00520.59
8.2.30.0000.00719.56
8.2.20.0040.00417.66
8.2.10.0000.00818.13
8.2.00.0030.00617.99
8.1.280.0070.01425.92
8.1.270.0040.00423.86
8.1.260.0040.01128.09
8.1.250.0000.00828.09
8.1.240.0030.00622.46
8.1.230.0040.00817.78
8.1.220.0040.00417.77
8.1.210.0060.00318.77
8.1.200.0090.00017.13
8.1.190.0040.00417.13
8.1.180.0000.00718.10
8.1.170.0040.00418.59
8.1.160.0040.00420.99
8.1.150.0000.00718.84
8.1.140.0070.00019.58
8.1.130.0000.00717.70
8.1.120.0040.00417.42
8.1.110.0040.00417.43
8.1.100.0060.00317.35
8.1.90.0040.00417.41
8.1.80.0000.00817.33
8.1.70.0030.00617.43
8.1.60.0040.00417.43
8.1.50.0080.00017.50
8.1.40.0040.00417.52
8.1.30.0030.00517.58
8.1.20.0030.00517.66
8.1.10.0000.00817.41
8.1.00.0000.00717.43
8.0.300.0080.00018.77
8.0.290.0020.00516.63
8.0.280.0070.00018.23
8.0.270.0050.00317.13
8.0.260.0040.00417.26
8.0.250.0030.00316.79
8.0.240.0040.00416.93
8.0.230.0060.00316.90
8.0.220.0040.00416.73
8.0.210.0040.00416.71
8.0.200.0070.00016.78
8.0.190.0030.00516.81
8.0.180.0040.00416.89
8.0.170.0000.00716.93
8.0.160.0000.00716.97
8.0.150.0050.00316.85
8.0.140.0000.00816.85
8.0.130.0000.00513.33
8.0.120.0040.00416.73
8.0.110.0040.00416.73
8.0.100.0000.00716.92
8.0.90.0000.00716.76
8.0.80.0070.00716.82
8.0.70.0040.00416.68
8.0.60.0080.00016.85
8.0.50.0000.00716.71
8.0.30.0100.00917.03
8.0.20.0080.01017.40
8.0.10.0050.00316.81
8.0.00.0070.01216.75
7.4.330.0000.00516.85
7.4.320.0030.00316.57
7.4.300.0030.00316.43
7.4.290.0000.00816.52
7.4.280.0070.00016.67
7.4.270.0000.00716.46
7.4.260.0040.00416.48
7.4.250.0040.00416.36
7.4.240.0000.00716.43
7.4.230.0000.00716.35
7.4.220.0130.00316.47
7.4.210.0080.00716.57
7.4.200.0040.00416.64
7.4.160.0100.00616.45
7.4.150.0070.01017.40
7.4.140.0150.01717.86
7.4.130.0070.01416.56
7.4.120.0110.01016.36
7.4.110.0100.00716.49
7.4.100.0140.00816.58
7.4.90.0130.00716.51
7.4.80.0100.00719.39
7.4.70.0030.01816.43
7.4.60.0080.00816.60
7.4.50.0090.00616.41
7.4.40.0130.00516.54
7.4.30.0080.00816.39
7.4.10.0070.01416.53
7.4.00.0090.00715.41
7.3.330.0060.00013.32
7.3.320.0050.00013.34
7.3.310.0040.00416.25
7.3.300.0060.00016.22
7.3.290.0000.00716.28
7.3.280.0100.00916.36
7.3.270.0190.00417.40
7.3.260.0170.00316.62
7.3.250.0110.00716.47
7.3.240.0090.00816.48
7.3.230.0110.00416.50
7.3.210.0090.01216.24
7.3.200.0100.00716.33
7.3.190.0100.00716.48
7.3.180.0120.00816.24
7.3.170.0070.01416.41
7.3.160.0000.01616.43
7.3.130.0130.00316.21
7.3.120.0080.00915.36
7.3.110.0020.01315.78
7.3.100.0070.00815.64
7.3.90.0080.00615.61
7.3.80.0070.00615.59
7.3.70.0030.01015.49
7.3.60.0080.00615.56
7.3.50.0080.00815.49
7.3.40.0010.01215.53
7.3.30.0080.00815.63
7.3.20.0070.00517.23
7.3.10.0020.01317.29
7.3.00.0050.00817.44
7.2.330.0080.00816.45
7.2.320.0090.00916.70
7.2.310.0140.00416.77
7.2.300.0190.00316.47
7.2.290.0140.00316.66
7.2.260.0050.01016.36
7.2.250.0040.01215.98
7.2.240.0070.01015.79
7.2.230.0050.01215.95
7.2.220.0020.01215.95
7.2.210.0020.01115.88
7.2.200.0060.01015.76
7.2.190.0080.00615.80
7.2.180.0090.00215.73
7.2.170.0030.01015.77
7.2.160.0060.00916.61
7.2.150.0070.00718.52
7.2.140.0090.00618.30
7.2.130.0040.00818.26
7.2.120.0070.00718.34
7.2.110.0030.00718.41
7.2.100.0110.00718.53
7.2.90.0090.00618.50
7.2.80.0100.00718.30
7.2.70.0100.00318.33
7.2.60.0040.01518.26
7.2.50.0090.00318.48
7.2.40.0180.00018.46
7.2.30.0030.01218.51
7.2.20.0080.00818.21
7.2.10.0100.00618.46
7.2.00.0070.00818.90
7.1.330.0060.00616.66
7.1.320.0050.00816.55
7.1.310.0070.00716.52
7.1.300.0080.00416.67
7.1.290.0050.00716.68
7.1.280.0050.00716.65
7.1.270.0040.00816.61
7.1.260.0030.00916.44
7.1.250.0070.00717.41
7.1.240.0060.00617.29
7.1.230.0030.01017.25
7.1.220.0030.01017.54
7.1.210.0000.01617.40
7.1.200.0060.00617.32
7.1.190.0100.00617.47
7.1.180.0040.01517.22
7.1.170.0040.00817.11
7.1.160.0040.01117.32
7.1.150.0000.01717.34
7.1.140.0030.01017.23
7.1.130.0070.00417.30
7.1.120.0140.00017.25
7.1.110.0040.00817.22
7.1.100.0420.00816.67
7.1.90.0060.00917.14
7.1.80.0070.00717.36
7.1.70.0030.01017.21
7.1.60.0060.01118.19
7.1.50.0030.01217.39
7.1.40.0030.01017.40
7.1.30.0030.01017.39
7.1.20.0110.00417.30
7.1.10.0070.00717.27
7.1.00.0030.04419.73
7.0.330.0040.00416.93
7.0.320.0030.00717.09
7.0.310.0040.01117.23
7.0.300.0130.00316.94
7.0.290.0060.00916.88
7.0.280.0090.00317.16
7.0.270.0060.00917.00
7.0.260.0000.00917.01
7.0.250.0070.00717.06
7.0.240.0030.01317.24
7.0.230.0070.01317.14
7.0.220.0040.01217.06
7.0.210.0030.01317.02
7.0.200.0390.00816.06
7.0.190.0030.01316.94
7.0.180.0030.00917.24
7.0.170.0070.00417.14
7.0.160.0120.00317.13
7.0.150.0080.00517.12
7.0.140.0030.01017.10
7.0.130.0000.01217.17
7.0.120.0100.00317.24
7.0.110.0110.00416.99
7.0.100.0040.01416.93
7.0.90.0000.00917.12
7.0.80.0000.01217.04
7.0.70.0000.01116.98
7.0.60.0160.04118.57
7.0.50.0030.03017.49
7.0.40.0110.04317.52
7.0.30.0200.03917.69
7.0.20.0120.03817.64
7.0.10.0100.04717.53
7.0.00.0070.03417.54
5.6.400.0080.00416.13
5.6.390.0090.00615.95
5.6.380.0030.01516.15
5.6.370.0130.00316.03
5.6.360.0030.01316.21
5.6.350.0030.00716.30
5.6.340.0070.00715.92
5.6.330.0040.01216.20
5.6.320.0120.00315.98
5.6.310.0070.00315.97
5.6.300.0070.01115.72
5.6.290.0030.01316.09
5.6.280.0070.03518.64
5.6.270.0060.00916.14
5.6.260.0030.00816.17
5.6.250.0040.01216.08
5.6.240.0100.00615.86
5.6.230.0100.00616.12
5.6.220.0040.01415.84
5.6.210.0110.04318.31
5.6.200.0100.03217.21
5.6.190.0130.04318.28
5.6.180.0070.02918.23
5.6.170.0240.03018.18
5.6.160.0080.04918.17
5.6.150.0050.02317.18
5.6.140.0090.04317.06
5.6.130.0110.03517.07
5.6.120.0040.03118.59
5.6.110.0050.02618.50
5.6.100.0100.03818.42
5.6.90.0150.04018.64
5.6.80.0040.02918.18
5.6.70.0070.01015.90
5.6.60.0060.01215.98
5.6.50.0030.01015.77
5.6.40.0060.00615.77
5.6.30.0030.01015.86
5.6.20.0030.00715.91
5.6.10.0040.00716.20
5.6.00.0040.01115.97
5.5.380.0040.00815.81
5.5.370.0090.00315.73
5.5.360.0030.01015.83
5.5.350.0160.04318.21
5.5.340.0050.03717.07
5.5.330.0030.02618.02
5.5.320.0170.04218.08
5.5.310.0160.03418.03
5.5.300.0080.04617.03
5.5.290.0040.02517.02
5.5.280.0070.03318.34
5.5.270.0030.05518.30
5.5.260.0120.04218.43
5.5.250.0120.04418.24
5.5.240.2150.02218.15
5.5.230.0100.00715.90
5.5.220.0100.00615.96
5.5.210.0070.00715.88
5.5.200.0030.00915.79
5.5.190.0080.00615.74
5.5.180.0040.01515.61
5.5.170.0060.00616.01
5.5.160.0040.01115.64
5.5.150.0090.00616.02
5.5.140.0000.02015.81
5.5.130.0000.01615.77
5.5.120.0100.00715.93
5.5.110.0050.01315.84
5.5.100.0070.01016.02
5.5.90.0110.00415.83
5.5.80.0080.00416.02
5.5.70.0130.00015.80
5.5.60.0080.00815.86
5.5.50.0060.01015.85
5.5.40.0000.01015.89
5.5.30.0030.01015.63
5.5.20.0060.00615.86
5.5.10.0060.00915.66
5.5.00.0040.00915.52

preferences:
55.55 ms | 401 KiB | 5 Q