3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'index1' => 'Deleted', 'index2' => 'numbers', 'index3' => 'test', 'index4' => 'Inserted', ); $specificIndex = 'index2'; $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.40.0090.00618.54
8.3.30.0080.00619.06
8.3.20.0040.00420.22
8.3.10.0070.00021.74
8.3.00.0090.00019.56
8.2.170.0100.00322.96
8.2.160.0100.00320.35
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0070.00419.48
8.2.110.0060.00321.00
8.2.100.0070.00318.03
8.2.90.0060.00317.93
8.2.80.0000.01017.97
8.2.70.0080.00018.16
8.2.60.0060.00318.16
8.2.50.0040.00418.10
8.2.40.0050.00322.15
8.2.30.0040.00418.13
8.2.20.0000.00817.70
8.2.10.0050.00318.07
8.2.00.0030.00518.11
8.1.270.0100.00020.37
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00617.71
8.1.230.0110.00020.84
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0060.00317.48
8.1.190.0100.00017.22
8.1.180.0050.00318.10
8.1.170.0030.00718.38
8.1.160.0000.00722.09
8.1.150.0040.00418.95
8.1.140.0070.00017.39
8.1.130.0000.00717.71
8.1.120.0050.00317.50
8.1.110.0000.00717.48
8.1.100.0040.00417.48
8.1.90.0070.00017.53
8.1.80.0040.00417.48
8.1.70.0070.00017.32
8.1.60.0060.00317.50
8.1.50.0000.00917.52
8.1.40.0000.00717.46
8.1.30.0030.00617.65
8.1.20.0050.00317.58
8.1.10.0040.00417.48
8.1.00.0050.00317.53
8.0.300.0000.00819.55
8.0.290.0000.00816.58
8.0.280.0000.00718.47
8.0.270.0030.00317.20
8.0.260.0030.00317.19
8.0.250.0070.00016.88
8.0.240.0040.00416.98
8.0.230.0070.00016.84
8.0.220.0000.00716.93
8.0.210.0040.00416.89
8.0.200.0000.00617.02
8.0.190.0000.00716.80
8.0.180.0050.00316.85
8.0.170.0030.00616.97
8.0.160.0050.00317.02
8.0.150.0030.00316.80
8.0.140.0080.00016.76
8.0.130.0030.00313.34
8.0.120.0080.00016.78
8.0.110.0040.00416.84
8.0.100.0000.00816.97
8.0.90.0080.00016.86
8.0.80.0110.01116.86
8.0.70.0070.00016.94
8.0.60.0040.00416.81
8.0.50.0040.00416.87
8.0.30.0050.01417.07
8.0.20.0120.00717.40
8.0.10.0000.00716.90
8.0.00.0120.00616.90
7.4.330.0050.00015.07
7.4.320.0060.00016.60
7.4.300.0030.00316.56
7.4.290.0000.00716.63
7.4.280.0100.00616.51
7.4.270.0030.00516.63
7.4.260.0040.00416.59
7.4.250.0000.00716.59
7.4.240.0040.00316.54
7.4.230.0030.00316.45
7.4.220.0030.01716.71
7.4.210.0000.01616.64
7.4.200.0030.00316.40
7.4.160.0030.01216.65
7.4.150.0100.00717.40
7.4.140.0160.00517.86
7.4.130.0100.00716.42
7.4.120.0110.00616.50
7.4.110.0120.00416.63
7.4.100.0090.00916.53
7.4.90.0070.01016.38
7.4.80.0070.01519.39
7.4.70.0160.00316.45
7.4.60.0060.01216.52
7.4.50.0020.00216.60
7.4.40.0110.00716.51
7.4.30.0070.01016.66
7.4.00.0090.00614.96
7.3.330.0060.00013.24
7.3.320.0020.00213.25
7.3.310.0040.00416.39
7.3.300.0000.00616.19
7.3.290.0090.00716.36
7.3.280.0100.00716.34
7.3.270.0190.01317.40
7.3.260.0130.00716.29
7.3.250.0140.00616.29
7.3.240.0110.00616.22
7.3.230.0120.00616.39
7.3.210.0100.00716.43
7.3.200.0060.00916.58
7.3.190.0030.01916.68
7.3.180.0060.01116.39
7.3.170.0120.00416.30
7.3.160.0090.00616.43
7.2.330.0090.00916.43
7.2.320.0110.00516.36
7.2.310.0030.01416.43
7.2.300.0070.01316.71
7.2.290.0080.00816.72
7.2.00.0040.01119.20
7.1.200.0030.00715.53
7.1.100.0070.00417.94
7.1.70.0040.00416.79
7.1.60.0100.01419.86
7.1.50.0070.01117.02
7.1.00.0000.07722.37
7.0.200.0000.00816.53
7.0.60.0130.07319.97
7.0.50.0130.08017.66
7.0.40.0070.05020.30
7.0.30.0300.07720.09
7.0.20.0300.06020.13
7.0.10.0030.08020.27
7.0.00.0100.05720.11
5.6.280.0000.07721.01
5.6.210.0230.06020.72
5.6.200.0100.07718.18
5.6.190.0070.06720.60
5.6.180.0500.06720.43
5.6.170.0470.04720.49
5.6.160.0070.03720.46
5.6.150.0030.03718.21
5.6.140.0200.07018.21
5.6.130.0100.05318.17
5.6.120.0000.05721.08
5.6.110.0070.08321.00
5.6.100.0130.08020.96
5.6.90.0000.06321.02
5.6.80.0130.07720.37
5.5.350.0200.08020.39
5.5.340.0070.08317.89
5.5.330.0070.07020.37
5.5.320.0300.07720.23
5.5.310.0230.04020.41
5.5.300.0070.03717.98
5.5.290.0030.05317.98
5.5.280.0070.05320.80
5.5.270.0070.08320.66
5.5.260.0070.03720.88
5.5.250.0030.06720.68
5.5.240.0070.07320.04
5.4.450.0130.05719.25
5.4.440.0770.05019.47
5.4.430.0100.05319.45
5.4.420.0100.06019.32
5.4.410.0170.04719.40
5.4.400.0100.05319.14
5.4.390.0130.05019.00
5.4.380.0100.06019.08
5.4.370.0230.06019.07
5.4.360.0100.05318.97
5.4.350.0130.05019.05
5.4.340.0070.05319.05
5.4.320.0100.05319.15
5.4.310.0230.04019.18
5.4.300.0130.05019.17
5.4.290.0100.05319.10
5.4.280.0030.06019.06
5.4.270.0170.04719.05
5.4.260.0170.04318.94
5.4.250.0070.05719.07
5.4.240.0100.05318.97
5.4.230.0170.05319.04
5.4.220.0130.05019.04
5.4.210.0130.05019.03
5.4.200.0170.04316.92
5.4.190.0100.05019.05
5.4.180.0100.05319.05
5.4.170.0130.05018.93
5.4.160.0070.05318.93
5.4.150.0100.05019.23
5.4.140.0130.04716.55
5.4.130.0170.04716.38
5.4.120.0070.05316.65
5.4.110.0070.05316.54
5.4.100.0170.04316.41
5.4.90.0030.05716.21
5.4.80.0200.04016.20
5.4.70.0170.04316.39
5.4.60.0070.05716.38
5.4.50.0100.04716.15
5.4.40.0030.06016.47
5.4.30.0030.06716.31
5.4.20.0200.04716.52
5.4.10.0070.05016.16
5.4.00.0130.04715.82
5.3.290.0130.05014.45
5.3.280.0100.05314.60
5.3.270.0100.06314.45
5.3.260.0230.06014.45
5.3.250.0100.06314.52
5.3.240.0100.05314.46
5.3.230.0070.05714.52
5.3.220.0170.05014.48
5.3.210.0000.06014.48
5.3.200.0100.05014.41
5.3.190.0170.04714.48
5.3.180.0070.05314.47
5.3.170.0170.04314.45
5.3.160.0100.05014.49
5.3.150.0100.05714.35
5.3.140.0100.05014.47
5.3.130.0070.05314.45
5.3.120.0070.05714.39
5.3.110.0100.05714.46
5.3.100.0100.05013.88
5.3.90.0130.04713.80
5.3.80.0100.05013.96
5.3.70.0130.06014.05
5.3.60.0130.04713.81
5.3.50.0130.06013.96
5.3.40.0170.05013.79
5.3.30.0100.05313.89
5.3.20.0100.04713.58
5.3.10.0100.05013.49
5.3.00.0070.05313.48
5.2.170.0100.04011.08
5.2.160.0030.04311.07
5.2.150.0100.04011.14
5.2.140.0070.04311.22
5.2.130.0070.04011.11
5.2.120.0030.04010.95
5.2.110.0100.03711.01
5.2.100.0070.04010.97
5.2.90.0100.03711.11
5.2.80.0070.04310.94
5.2.70.0070.04311.04
5.2.60.0070.04010.99
5.2.50.0100.05310.86
5.2.40.0170.03010.91
5.2.30.0070.04010.96
5.2.20.0030.04310.79
5.2.10.0030.04010.95
5.2.00.0100.03710.70
5.1.60.0100.0279.92
5.1.50.0030.03710.02
5.1.40.0100.0309.96
5.1.30.0030.03710.18
5.1.20.0030.04010.43
5.1.10.0100.0339.97
5.1.00.0070.03310.10
5.0.50.0030.0308.63
5.0.40.0000.0338.48
5.0.30.0070.0408.21
5.0.20.0100.0278.12
5.0.10.0070.0238.30
5.0.00.0130.0408.15
4.4.90.0070.0235.75
4.4.80.0030.0205.74
4.4.70.0030.0235.77
4.4.60.0000.0235.86
4.4.50.0000.0235.76
4.4.40.0030.0335.75
4.4.30.0000.0235.75
4.4.20.0030.0235.89
4.4.10.0070.0205.83
4.4.00.0000.0375.78
4.3.110.0100.0175.68
4.3.100.0070.0175.74
4.3.90.0000.0235.81
4.3.80.0070.0305.65
4.3.70.0000.0235.81
4.3.60.0030.0205.68
4.3.50.0000.0235.76
4.3.40.0070.0405.73
4.3.30.0030.0274.45
4.3.20.0030.0274.47
4.3.10.0000.0234.38
4.3.00.0130.0177.03

preferences:
54.46 ms | 400 KiB | 5 Q