3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'index1' => 'Deleted', 'index2' => 'numbers', 'index3' => 'test', 'index4' => 'Inserted', ); $specificIndex = array('index2','index3'); $array1=array(); foreach($array as $key => $value){ if($key == $specificIndex){ $array1[$key] = $value; unset($array[$specificIndex]); } } print_r($array); print_r($array1);

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.0120.00618.30
8.3.50.0100.00821.23
8.3.40.0120.00318.53
8.3.30.0100.00318.92
8.3.20.0000.00720.07
8.3.10.0070.00023.65
8.3.00.0040.00419.56
8.2.180.0140.00418.41
8.2.170.0140.00718.79
8.2.160.0140.00022.96
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0060.00319.28
8.2.110.0080.00020.41
8.2.100.0080.00318.09
8.2.90.0000.00819.17
8.2.80.0000.00817.97
8.2.70.0040.00417.25
8.2.60.0070.00317.93
8.2.50.0050.00518.07
8.2.40.0050.00320.01
8.2.30.0030.00518.07
8.2.20.0060.00317.55
8.2.10.0000.00718.19
8.2.00.0000.00718.18
8.1.280.0070.01025.92
8.1.270.0040.00420.21
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0130.00323.76
8.1.230.0110.00019.01
8.1.220.0000.00717.76
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0050.00317.23
8.1.180.0040.00418.10
8.1.170.0000.00918.57
8.1.160.0040.00421.94
8.1.150.0000.00718.77
8.1.140.0040.00417.37
8.1.130.0020.00517.83
8.1.120.0070.00017.45
8.1.110.0040.00417.46
8.1.100.0040.00317.47
8.1.90.0050.00217.39
8.1.80.0000.00717.50
8.1.70.0030.00317.50
8.1.60.0040.00417.54
8.1.50.0000.00717.55
8.1.40.0020.00517.50
8.1.30.0040.00417.69
8.1.20.0030.00617.57
8.1.10.0040.00417.32
8.1.00.0040.00417.33
8.0.300.0000.00818.77
8.0.290.0000.00716.62
8.0.280.0070.00018.52
8.0.270.0030.00517.18
8.0.260.0000.00617.26
8.0.250.0040.00416.95
8.0.240.0030.00316.87
8.0.230.0000.00716.87
8.0.220.0040.00416.88
8.0.210.0000.00816.84
8.0.200.0000.00616.90
8.0.190.0040.00416.88
8.0.180.0000.00816.82
8.0.170.0040.00416.93
8.0.160.0060.00316.93
8.0.150.0070.00016.75
8.0.140.0050.00316.72
8.0.130.0030.00313.28
8.0.120.0040.00416.81
8.0.110.0040.00416.87
8.0.100.0060.00316.69
8.0.90.0030.00516.81
8.0.80.0030.01316.84
8.0.70.0000.00716.79
8.0.60.0050.00216.77
8.0.50.0000.00716.87
8.0.30.0120.00617.00
8.0.20.0160.00517.40
8.0.10.0040.00416.92
8.0.00.0100.00716.84
7.4.330.0000.00515.09
7.4.320.0000.00716.52
7.4.300.0000.00616.43
7.4.290.0030.00316.49
7.4.280.0030.00916.60
7.4.270.0040.00416.53
7.4.260.0000.00716.52
7.4.250.0000.00716.52
7.4.240.0040.00416.54
7.4.230.0030.00316.68
7.4.220.0060.01416.56
7.4.210.0100.00316.68
7.4.200.0030.00316.69
7.4.160.0090.00616.66
7.4.150.0070.01017.40
7.4.140.0140.00717.86
7.4.130.0140.00516.49
7.4.120.0060.01216.63
7.4.110.0070.01116.54
7.4.100.0050.01916.49
7.4.90.0100.00716.50
7.4.80.0120.00419.39
7.4.70.0030.01316.50
7.4.60.0060.01016.57
7.4.50.0000.00416.37
7.4.40.0060.01316.39
7.4.30.0030.01416.39
7.4.00.0030.01115.01
7.3.330.0050.00013.18
7.3.320.0030.00313.12
7.3.310.0000.00816.21
7.3.300.0030.00316.25
7.3.290.0090.00716.32
7.3.280.0090.01216.28
7.3.270.0120.00717.40
7.3.260.0050.01516.34
7.3.250.0070.01116.31
7.3.240.0190.00316.31
7.3.230.0030.01516.45
7.3.210.0060.01216.56
7.3.200.0050.01516.59
7.3.190.0040.01116.63
7.3.180.0140.00316.17
7.3.170.0030.01316.32
7.3.160.0060.00916.30
7.2.330.0110.00716.61
7.2.320.0030.01316.68
7.2.310.0110.00716.70
7.2.300.0100.00616.61
7.2.290.0080.01216.59
7.2.00.0040.00719.40
7.1.200.0120.00315.79
7.1.100.0040.00717.98
7.1.70.0180.00017.13
7.1.60.0100.01319.86
7.1.50.0070.01716.92
7.1.00.0070.07322.37
7.0.200.0000.00816.79
7.0.60.0030.08319.82
7.0.50.0070.08017.88
7.0.40.0100.05020.20
7.0.30.0370.08020.02
7.0.20.0330.07720.12
7.0.10.0070.08320.34
7.0.00.0100.04020.16
5.6.280.0000.07720.86
5.6.210.0070.07320.52
5.6.200.0100.08018.19
5.6.190.0030.04320.45
5.6.180.0400.06320.61
5.6.170.0370.07320.51
5.6.160.0000.04320.48
5.6.150.0100.03318.13
5.6.140.0130.05718.23
5.6.130.0070.05018.16
5.6.120.0100.06720.99
5.6.110.0070.09721.14
5.6.100.0000.09020.97
5.6.90.0070.08721.11
5.6.80.0030.07720.43
5.5.350.0100.05320.41
5.5.340.0130.04318.01
5.5.330.0100.08720.43
5.5.320.0270.05320.23
5.5.310.0300.06320.29
5.5.300.0070.03717.96
5.5.290.0000.06718.00
5.5.280.0030.07320.71
5.5.270.0030.06020.94
5.5.260.0030.04020.64
5.5.250.0030.07320.68
5.5.240.0070.07020.25
5.4.450.0330.06719.64
5.4.440.0700.06319.61
5.4.430.0100.05319.42
5.4.420.0170.05019.30
5.4.410.0030.06319.57
5.4.400.0070.06019.32
5.4.390.0130.05718.96
5.4.380.0130.05319.14
5.4.370.0100.05318.95
5.4.360.0130.05019.05
5.4.350.0100.06319.01
5.4.340.0130.04719.14
5.4.320.0030.07018.98
5.4.310.0100.05319.09
5.4.300.0070.05719.12
5.4.290.0130.04719.15
5.4.280.0100.05319.25
5.4.270.0070.06718.99
5.4.260.0070.05719.04
5.4.250.0130.06719.15
5.4.240.0130.05318.98
5.4.230.0100.05318.96
5.4.220.0170.06019.24
5.4.210.0070.05719.13
5.4.200.0100.05016.93
5.4.190.0070.05719.13
5.4.180.0070.06018.95
5.4.170.0200.05319.13
5.4.160.0100.05319.17
5.4.150.0070.05719.03
5.4.140.0070.05716.40
5.4.130.0100.05316.52
5.4.120.0170.05316.21
5.4.110.0100.05316.34
5.4.100.0170.04316.22
5.4.90.0100.05316.53
5.4.80.0070.05316.17
5.4.70.0130.04716.09
5.4.60.0130.05016.09
5.4.50.0130.05316.20
5.4.40.0200.05016.16
5.4.30.0030.05316.31
5.4.20.0070.05716.31
5.4.10.0070.05016.31
5.4.00.0200.04016.02
5.3.290.0030.06014.68
5.3.280.0070.06314.63
5.3.270.0200.04714.52
5.3.260.0070.05714.50
5.3.250.0130.05714.44
5.3.240.0130.05314.53
5.3.230.0030.06014.51
5.3.220.0130.05014.40
5.3.210.0130.05014.58
5.3.200.0130.05714.44
5.3.190.0100.05014.43
5.3.180.0200.04714.57
5.3.170.0170.06314.35
5.3.160.0100.05314.34
5.3.150.0000.06714.39
5.3.140.0100.05314.45
5.3.130.0130.06714.41
5.3.120.0270.05714.58
5.3.110.0070.05714.55
5.3.100.0030.05713.91
5.3.90.0130.05314.02
5.3.80.0170.06013.85
5.3.70.0100.05013.95
5.3.60.0100.06713.84
5.3.50.0130.05013.84
5.3.40.0000.06013.78
5.3.30.0200.04013.75
5.3.20.0100.04713.54
5.3.10.0000.06013.44
5.3.00.0100.05313.65
5.2.170.0000.05011.15
5.2.160.0030.04311.15
5.2.150.0070.04011.04
5.2.140.0070.04311.22
5.2.130.0130.03710.99
5.2.120.0100.03711.11
5.2.110.0100.03710.99
5.2.100.0100.04010.94
5.2.90.0130.03710.95
5.2.80.0170.04011.01
5.2.70.0030.04710.95
5.2.60.0070.05311.05
5.2.50.0100.04310.96
5.2.40.0030.04710.98
5.2.30.0070.05710.83
5.2.20.0100.05310.87
5.2.10.0100.03310.81
5.2.00.0070.04010.69
5.1.60.0030.0409.92
5.1.50.0130.02710.07
5.1.40.0030.05010.08
5.1.30.0100.03710.27
5.1.20.0070.04010.30
5.1.10.0030.0409.99
5.1.00.0070.03710.11
5.0.50.0030.0308.46
5.0.40.0000.0408.30
5.0.30.0000.0578.22
5.0.20.0100.0308.11
5.0.10.0070.0338.16
5.0.00.0030.0438.09
4.4.90.0030.0205.86
4.4.80.0070.0205.85
4.4.70.0070.0205.85
4.4.60.0070.0175.80
4.4.50.0070.0205.75
4.4.40.0070.0335.89
4.4.30.0000.0275.84
4.4.20.0030.0235.87
4.4.10.0130.0135.86
4.4.00.0030.0375.84
4.3.110.0030.0235.80
4.3.100.0030.0205.70
4.3.90.0030.0205.75
4.3.80.0070.0305.80
4.3.70.0000.0235.64
4.3.60.0000.0235.67
4.3.50.0070.0175.75
4.3.40.0000.0375.62
4.3.30.0030.0204.44
4.3.20.0000.0234.49
4.3.10.0070.0174.46
4.3.00.0170.0207.03

preferences:
56.56 ms | 401 KiB | 5 Q