3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["key" => 0, "value" => 25], ["key" => 1, "value" => 25], ["key" => 2, "value" => 25], ["key" => 3, "value" => 33], ["key" => 4, "value" => 45], ["key" => 5, "value" => 66], ["key" => 6, "value" => 66], ["key" => 7, "value" => 66], ["key" => 8, "value" => 66], ["key" => 9, "value" => 55], ]; $r = []; $lastKey = ''; foreach($array as $k => $v){ if(in_array($v['value'], array_column($r, 'value'))){ $lastKey = $v['key']; }else{ if($lastKey && !in_array($lastKey, array_column($r, 'key'))){ end($r); $r[] = [ 'key' => $lastKey, 'value' => $r[key($r)]['value']]; } $r[] = [ 'key' => $v['key'] , 'value' => $v['value'] ]; $lastKey = $v['key']; } } echo '<pre>'; print_r($r);

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.4.130.0110.00917.79
8.4.120.0150.00620.52
8.4.110.0120.00822.32
8.4.100.0030.00717.86
8.4.90.0110.00920.29
8.4.80.0150.00619.54
8.4.70.0140.00518.04
8.4.60.0100.00618.77
8.4.50.0100.00920.68
8.4.40.0090.00917.70
8.4.30.0100.01022.28
8.4.20.0100.00718.62
8.4.10.0050.00519.68
8.3.260.0020.00716.59
8.3.250.0100.00818.76
8.3.240.0100.01016.48
8.3.230.0060.00316.52
8.3.220.0120.00817.33
8.3.210.0090.01016.64
8.3.200.0040.00516.86
8.3.190.0130.00617.11
8.3.180.0130.00716.77
8.3.170.0120.00617.11
8.3.160.0100.00618.42
8.3.150.0000.00916.77
8.3.140.0040.00717.03
8.3.130.0050.00518.46
8.3.120.0040.00419.02
8.3.110.0000.00816.49
8.3.100.0040.00416.41
8.3.90.0100.00026.77
8.3.80.0090.00016.50
8.3.70.0040.01216.58
8.3.60.0130.00318.22
8.3.50.0120.00718.34
8.3.40.0150.00418.77
8.3.30.0130.00318.67
8.3.20.0050.00320.89
8.3.10.0080.00021.73
8.3.00.0040.00423.46
8.2.290.0160.00520.36
8.2.280.0140.00518.58
8.2.270.0070.00417.00
8.2.260.0030.00616.73
8.2.250.0040.00416.55
8.2.240.0070.01116.34
8.2.230.0060.00320.94
8.2.220.0090.00024.06
8.2.210.0080.00026.77
8.2.200.0040.00416.25
8.2.190.0170.00316.58
8.2.180.0100.00716.50
8.2.170.0120.00318.91
8.2.160.0110.00421.20
8.2.150.0030.00525.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00026.16
8.2.110.0060.00322.25
8.2.100.0040.00817.75
8.2.90.0040.00422.33
8.2.80.0000.00819.42
8.2.70.0040.00418.03
8.2.60.0080.00018.28
8.2.50.0050.00318.10
8.2.40.0000.00819.51
8.2.30.0000.00719.29
8.2.20.0000.00718.03
8.2.10.0040.00419.29
8.2.00.0070.00019.35
8.1.330.0050.00422.03
8.1.320.0090.01016.10
8.1.310.0100.00718.40
8.1.300.0120.00620.25
8.1.290.0030.00630.84
8.1.280.0120.00625.92
8.1.270.0080.00024.66
8.1.260.0070.00026.35
8.1.250.0030.00628.09
8.1.240.0090.00022.45
8.1.230.0060.00621.03
8.1.220.0030.00517.74
8.1.210.0080.00018.95
8.1.200.0040.00417.23
8.1.190.0050.00317.25
8.1.180.0040.00418.10
8.1.170.0030.00618.61
8.1.160.0000.00818.89
8.1.150.0030.00518.80
8.1.140.0040.00318.88
8.1.130.0000.00717.45
8.1.120.0040.00417.47
8.1.110.0040.00417.38
8.1.100.0040.00417.33
8.1.90.0060.00317.35
8.1.80.0040.00417.30
8.1.70.0070.00017.35
8.1.60.0030.00617.60
8.1.50.0000.00717.37
8.1.40.0000.00917.52
8.1.30.0040.00817.66
8.1.20.0050.00317.48
8.1.10.0040.00417.51
8.1.00.0040.00417.55
8.0.300.0060.00319.89
8.0.290.0080.00016.75
8.0.280.0080.00018.50
8.0.270.0080.00017.18
8.0.260.0080.00016.68
8.0.250.0060.00016.96
8.0.240.0000.00616.94
8.0.230.0000.00716.92
8.0.220.0050.00316.88
8.0.210.0040.00416.86
8.0.200.0030.00616.96
8.0.190.0030.00316.85
8.0.180.0070.00016.82
8.0.170.0060.00316.88
8.0.160.0040.00416.95
8.0.150.0040.00416.84
8.0.140.0000.00716.91
8.0.130.0050.00013.32
8.0.120.0040.00416.75
8.0.110.0030.00516.89
8.0.100.0050.00216.70
8.0.90.0040.00416.89
8.0.80.0050.01116.87
8.0.70.0020.00516.76
8.0.60.0000.00716.80
8.0.50.0080.00016.96
8.0.30.0070.01116.90
8.0.20.0170.00817.06
8.0.10.0040.00416.91
8.0.00.0100.00816.80
7.4.330.0050.00015.55
7.4.320.0060.00016.58
7.4.300.0000.00616.50
7.4.290.0070.00016.55
7.4.280.0030.00716.60
7.4.270.0030.00316.53
7.4.260.0000.00816.48
7.4.250.0080.00016.41
7.4.240.0050.00316.58
7.4.230.0030.00316.48
7.4.220.0000.00716.58
7.4.210.0080.00716.59
7.4.200.0000.00816.36
7.4.130.0160.00616.46
7.4.120.0130.00316.48
7.4.110.0070.01016.58
7.4.100.0070.01016.47
7.4.90.0040.01516.66
7.4.80.0140.00319.39
7.4.70.0040.01416.61
7.4.60.0060.01016.58
7.4.50.0000.01416.14
7.4.40.0130.01016.46
7.4.00.0070.01015.09
7.3.330.0000.00513.30
7.3.320.0030.00313.12
7.3.310.0000.00716.17
7.3.300.0040.00416.32
7.3.290.0110.00416.29
7.3.280.0180.00316.26
7.3.260.0090.01116.47
7.3.240.0100.00816.46
7.3.230.0140.00416.29
7.3.210.0130.01016.27
7.3.200.0080.00816.60
7.3.190.0030.01316.55
7.3.180.0030.01716.50
7.3.170.0000.01616.41
7.3.160.0080.00816.37
7.3.60.0040.00814.50
7.3.50.0030.01014.45
7.3.40.0070.00714.64
7.3.30.0040.00814.61
7.3.20.0000.01416.60
7.3.10.0000.01316.62
7.3.00.0070.00716.54
7.2.330.0090.00916.71
7.2.320.0040.01216.87
7.2.310.0090.00616.54
7.2.300.0100.00716.69
7.2.290.0070.01016.84
7.2.190.0030.01014.86
7.2.180.0080.00414.66
7.2.170.0090.00614.81
7.2.160.0090.00315.08
7.2.150.0120.00316.64
7.2.140.0090.00616.88
7.2.130.0120.00916.78
7.2.120.0090.01316.80
7.2.110.0040.01316.73
7.2.100.0060.00616.72
7.2.90.0090.00616.76
7.2.80.0060.00916.96
7.2.70.0110.00516.98
7.2.60.0110.00516.85
7.2.50.0070.00716.91
7.2.40.0000.01416.79
7.2.30.0080.00816.62
7.2.20.0070.01016.80
7.2.10.0040.00716.63
7.2.00.0120.00417.14
7.1.300.0060.00615.71
7.1.290.0120.00615.56
7.1.280.0060.00915.46
7.1.270.0030.01015.58
7.1.260.0070.00715.76
7.1.250.0080.01315.60

preferences:
29.4 ms | 403 KiB | 5 Q