3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 0 => [ 'id' => 20, 'name' => 'Test' ], 1 => [ 'id' => 20, 'name' => 'Test1' ], 2 => [ 'id' => 12, 'name' => 'Test2' ], 3 => [ 'id' => 24, 'name' => 'Test3' ] ]; $arr = $currentValue = $previousValue = ['id' => '']; foreach($array as $key => $value) { $currentValue = [ 'id' => $previousValue['id'] === $value['id'] ? '' : $value['id'], 'name' => $value['name'] ]; $arr[] = $previousValue = $currentValue; } var_dump($arr);

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.0110.00419.66
8.3.40.0120.00318.67
8.3.30.0060.00918.69
8.3.20.0040.00421.79
8.3.10.0000.00820.58
8.3.00.0060.00321.96
8.2.180.0100.01016.50
8.2.170.0120.00322.96
8.2.160.0030.01022.25
8.2.150.0040.00424.18
8.2.140.0060.00924.66
8.2.130.0040.00418.03
8.2.120.0040.00426.35
8.2.110.0090.00019.31
8.2.100.0060.00617.72
8.2.90.0040.00419.20
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0080.00018.03
8.2.50.0030.00618.10
8.2.40.0040.00420.51
8.2.30.0000.00819.26
8.2.20.0040.00418.09
8.2.10.0030.00618.11
8.2.00.0040.00417.73
8.1.280.0120.00325.92
8.1.270.0040.00423.97
8.1.260.0080.00026.35
8.1.250.0020.00528.09
8.1.240.0080.00823.65
8.1.230.0040.00817.95
8.1.220.0090.00017.76
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0000.00817.00
8.1.180.0040.00418.10
8.1.170.0080.00018.64
8.1.160.0000.00718.99
8.1.150.0000.00722.04
8.1.140.0070.00019.61
8.1.130.0070.00018.96
8.1.120.0000.00717.42
8.1.110.0050.00317.40
8.1.100.0050.00217.48
8.1.90.0000.00717.37
8.1.80.0040.00417.40
8.1.70.0000.00717.47
8.1.60.0060.00317.46
8.1.50.0000.00717.51
8.1.40.0070.00017.54
8.1.30.0040.00417.69
8.1.20.0040.00417.63
8.1.10.0040.00417.47
8.1.00.0060.00317.33
8.0.300.0000.00718.77
8.0.290.0060.00316.63
8.0.280.0080.00018.43
8.0.270.0030.00317.21
8.0.260.0030.00517.23
8.0.250.0000.00716.93
8.0.240.0070.00016.92
8.0.230.0050.00416.84
8.0.220.0000.00716.78
8.0.210.0020.00516.85
8.0.200.0070.00016.93
8.0.190.0050.00316.83
8.0.180.0030.00316.89
8.0.170.0040.00416.89
8.0.160.0000.00716.89
8.0.150.0040.00416.86
8.0.140.0000.00816.76
8.0.130.0050.00013.32
8.0.120.0040.00416.73
8.0.110.0000.00716.82
8.0.100.0000.00716.77
8.0.90.0020.00516.79
8.0.80.0030.01616.90
8.0.70.0000.00716.82
8.0.60.0040.00416.68
8.0.50.0040.00416.82
8.0.30.0090.00917.07
8.0.20.0090.01017.40
8.0.10.0040.00417.04
8.0.00.0080.00916.65
7.4.330.0000.00515.55
7.4.320.0060.00016.50
7.4.300.0000.00616.59
7.4.290.0030.00316.43
7.4.280.0000.00816.57
7.4.270.0030.00316.58
7.4.260.0070.00016.46
7.4.250.0040.00416.36
7.4.240.0000.00716.52
7.4.230.0050.00316.62
7.4.220.0080.00916.69
7.4.210.0030.01716.58
7.4.200.0070.00016.39
7.4.160.0100.00416.58
7.4.150.0140.00517.40
7.4.140.0120.00617.86
7.4.130.0120.01116.46
7.4.120.0130.01016.56
7.4.110.0130.01016.64
7.4.100.0040.01416.34
7.4.90.0030.01416.58
7.4.80.0120.00619.39
7.4.70.0100.01016.55
7.4.60.0090.00916.50
7.4.50.0040.01116.46
7.4.40.0110.00616.29
7.4.30.0080.00816.60
7.4.00.0090.00615.11
7.3.330.0050.00013.08
7.3.320.0020.00213.17
7.3.310.0040.00416.37
7.3.300.0070.00016.36
7.3.290.0110.00316.36
7.3.280.0090.00916.33
7.3.270.0060.01117.40
7.3.260.0030.01716.40
7.3.250.0120.00916.33
7.3.240.0130.00716.57
7.3.230.0090.00916.52
7.3.210.0130.00616.36
7.3.200.0130.01016.41
7.3.190.0070.01016.51
7.3.180.0030.01316.45
7.3.170.0130.00416.31
7.3.160.0130.00916.51
7.3.10.0110.00416.57
7.3.00.0060.00616.69
7.2.330.0130.00616.49
7.2.320.0120.00916.74
7.2.310.0130.00316.69
7.2.300.0180.00416.57
7.2.290.0100.00716.72
7.2.130.0040.01117.13
7.2.120.0070.00716.75
7.2.110.0080.00816.64
7.2.100.0120.00017.00
7.2.90.0070.00716.92
7.2.80.0080.00817.05
7.2.70.0140.00016.92
7.2.60.0060.00917.05
7.2.50.0000.01616.88
7.2.40.0050.00517.09
7.2.30.0080.00816.77
7.2.20.0090.00616.97
7.2.10.0040.01117.04
7.2.00.0070.00317.02
7.1.250.0030.01215.67
7.1.200.0050.00515.84
7.1.70.0070.00317.22
7.1.60.0060.00617.36
7.1.10.0100.05722.15
7.1.00.0000.07322.32
7.0.200.0000.01116.75
7.0.150.0070.05721.75
7.0.140.0070.05721.91
7.0.130.0030.05721.91
7.0.120.0130.04721.91
7.0.110.0070.06021.81
7.0.100.0030.06021.81
7.0.90.0070.06021.91
7.0.80.0070.05721.95
7.0.70.0100.07721.91
7.0.60.0030.06021.92
7.0.50.0100.05321.89
7.0.40.0070.05321.93
7.0.30.0030.05721.84
7.0.20.0070.05321.89
7.0.10.0030.05721.85
7.0.00.0000.06021.92

preferences:
62.35 ms | 401 KiB | 5 Q