3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ [ "id" => '6230061c0e88d709ca0d7bbc', 'name' => 'Mobile SamSung', 'slug' => 'mobile-samsung', 'createdAt' => '1648006346' ], [ "id" => '5d1eff529a426778d4b92383', 'name' => 'Mobile Iphone', 'slug' => 'mobile-iphone', 'createdAt' => '1647314181' ], [ "id" => '5d1eff6b9a426778d4b92dc4', 'name' => 'Mobile SamSung', 'slug' => 'mobile-samsung', 'createdAt' => '1647314460' ], [ "id" => '5f894011266aea580b028cb0', 'name' => 'Mobile LG', 'slug' => 'mobile-lg', 'createdAt' => '1647314456' ] ]; $newArray = []; foreach ($array as $key => $value) { $findIndex = array_search($value['slug'], array_column($newArray, 'slug')); if ($findIndex === false) { $newArray[] = $value; } elseif ($findIndex !== false && $newArray[$findIndex]['createdAt'] <= $value['createdAt']) { $newArray[$findIndex] = $value; } } 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.5.60.0080.00916.83
8.5.50.0090.00816.69
8.5.30.0090.00820.04
8.5.20.0100.00819.89
8.5.10.0090.00818.58
8.5.00.0120.00920.05
8.4.210.0060.00719.40
8.4.180.0140.00722.08
8.4.170.0140.00723.91
8.4.160.0100.01123.87
8.4.150.0070.00516.89
8.4.140.0130.00817.82
8.4.130.0070.00217.91
8.4.120.0090.01220.73
8.4.110.0020.00722.45
8.4.100.0120.00918.70
8.4.90.0110.01022.45
8.4.80.0140.00518.82
8.4.70.0120.01318.76
8.4.60.0040.00418.86
8.4.50.0100.01018.55
8.4.40.0090.00619.28
8.4.30.0130.00620.71
8.4.20.0100.01017.82
8.4.10.0130.00720.52
8.3.300.0150.00718.99
8.3.290.0130.00820.82
8.3.280.0070.01418.56
8.3.270.0110.00816.71
8.3.260.0090.00916.55
8.3.250.0060.00318.98
8.3.240.0070.00116.41
8.3.230.0090.00916.50
8.3.220.0100.00718.98
8.3.210.0030.00516.54
8.3.200.0080.00316.72
8.3.190.0080.01117.05
8.3.180.0090.00819.00
8.3.170.0090.01016.64
8.3.160.0110.00719.14
8.3.150.0080.00018.96
8.3.140.0060.01219.16
8.3.130.0060.00318.54
8.3.120.0050.00319.09
8.3.110.0100.00620.94
8.3.100.0130.00324.06
8.3.90.0040.00426.77
8.3.80.0060.00316.37
8.3.70.0150.00016.75
8.3.60.0150.00016.75
8.3.50.0090.00920.25
8.3.40.0140.00321.93
8.3.30.0100.00319.38
8.3.20.0000.00724.18
8.3.10.0030.00524.66
8.3.00.0050.00226.16
8.2.300.0160.01020.35
8.2.290.0110.00718.90
8.2.280.0110.00818.31
8.2.270.0160.00318.83
8.2.260.0040.00416.46
8.2.250.0050.00318.45
8.2.240.0050.00519.04
8.2.230.0030.00722.58
8.2.220.0030.00537.54
8.2.210.0070.01126.77
8.2.200.0050.00518.66
8.2.190.0110.00418.41
8.2.180.0110.00425.92
8.2.170.0000.01418.92
8.2.160.0110.00422.96
8.2.150.0070.00025.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0000.00719.84
8.2.110.0040.00420.56
8.2.100.0090.00317.91
8.2.90.0040.00417.75
8.2.80.0080.00018.73
8.2.70.0030.00617.75
8.2.60.0040.00417.63
8.2.50.0030.00517.55
8.2.40.0040.00418.26
8.2.30.0040.00418.19
8.2.20.0040.00420.44
8.2.10.0070.00018.01
8.2.00.0000.00719.40
8.1.340.0070.01317.74
8.1.330.0130.00616.00
8.1.320.0130.00716.25
8.1.310.0040.00416.62
8.1.300.0000.00818.41
8.1.290.0070.00330.84
8.1.280.0070.01125.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00623.92
8.1.230.0080.00322.24
8.1.220.0040.00418.70
8.1.210.0090.00018.77
8.1.200.0040.00417.35
8.1.190.0030.00617.22
8.1.180.0030.00518.10
8.1.170.0040.00418.54
8.1.160.0030.00518.77
8.1.150.0040.00418.52
8.1.140.0000.00817.46
8.1.130.0030.00318.83
8.1.120.0000.00717.45
8.1.110.0000.00717.35
8.1.100.0000.00917.52
8.1.90.0080.00017.36
8.1.80.0000.00717.37
8.1.70.0030.00317.43
8.1.60.0030.00617.66
8.1.50.0030.00617.54
8.1.40.0070.00317.39
8.1.30.0050.00617.55
8.1.20.0000.01017.65
8.1.10.0110.00017.35
8.1.00.0060.00317.38
8.0.300.0000.00719.98
8.0.290.0040.00416.88
8.0.280.0030.00318.39
8.0.270.0030.00316.84
8.0.260.0070.00018.34
8.0.250.0030.00316.83
8.0.240.0000.00716.91
8.0.230.0040.00417.02
8.0.220.0030.00616.79
8.0.210.0050.00316.83
8.0.200.0000.00716.87
8.0.190.0070.00016.83
8.0.180.0000.00716.84
8.0.170.0000.01216.74
8.0.160.0040.00416.87
8.0.150.0030.00716.83
8.0.140.0090.00016.70
8.0.130.0030.01016.81
8.0.120.0000.01016.88
8.0.110.0070.00716.74
8.0.100.0030.00616.93
8.0.90.0070.00416.84
8.0.80.0090.00016.91
8.0.70.0000.00916.96
8.0.60.0100.00016.89
8.0.50.0050.00316.83
8.0.30.0070.00316.86
8.0.20.0060.00316.96
8.0.10.0050.00516.82
7.4.330.0000.00515.55
7.4.320.0000.00616.64
7.4.300.0040.00416.49
7.4.290.0040.00416.56
7.4.280.0060.00316.03
7.4.270.0000.00816.16
7.4.260.0030.00616.28
7.4.250.0100.00316.20
7.4.240.0060.00616.37
7.4.230.0130.00616.26
7.4.220.0050.01016.20
7.4.210.0130.00016.20
7.4.200.0090.00716.21
7.4.190.0110.00416.16
7.4.180.0090.00516.39
7.4.160.0180.00016.30
7.4.150.0150.00316.05
7.4.140.0080.00816.11
7.4.130.0060.00616.07
7.4.120.0090.00515.84
7.4.110.0070.00916.36
7.4.100.0090.00615.99
7.4.90.0120.00016.16
7.4.80.0160.00016.02
7.4.70.0000.00816.07
7.4.60.0000.00915.92
7.4.50.0070.00216.36
7.4.40.0140.00016.15
7.4.30.0100.00716.09
7.4.20.0100.00416.27
7.4.10.0090.00216.38
7.4.00.0050.00316.36

preferences:
55.71 ms | 1354 KiB | 5 Q