3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Remove duplicate elements from an array using a user-defined Reductor function. * @param array $array * @param callable $reductor Reduces a single array element to a simple type for equivalence checking. */ function array_uunique(array $array, callable $reductor) { $seen = []; return array_filter( $array, function($a)use(&$seen, $reductor){ $val = $reductor($a); if( ! in_array($val, $seen, true) ) { $seen[] = $val; return true; } else { return false; } } ); } $arr = [ [ 'target' => 'a' ], [ 'target' => 'b' ], [ 'target' => 'c' ], [ 'target' => 'd' ], [ 'target' => 'c' ], [ 'target' => 'e' ], ]; echo json_encode( array_uunique($arr, function($a){return $a['target'];}), JSON_PRETTY_PRINT ) . PHP_EOL;

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.0110.01118.25
8.3.50.0150.00016.39
8.3.40.0120.00618.91
8.3.30.0150.00018.90
8.3.20.0070.00020.35
8.3.10.0040.00421.60
8.3.00.0040.00422.43
8.2.180.0070.01116.50
8.2.170.0090.00922.96
8.2.160.0140.00019.39
8.2.150.0050.00524.18
8.2.140.0080.00024.66
8.2.130.0000.00720.39
8.2.120.0050.00326.35
8.2.110.0070.00322.19
8.2.100.0070.00417.91
8.2.90.0000.00819.36
8.2.80.0050.00317.97
8.2.70.0040.00717.62
8.2.60.0000.00817.91
8.2.50.0040.00418.22
8.2.40.0030.00520.32
8.2.30.0050.00319.28
8.2.20.0070.00018.25
8.2.10.0000.00718.07
8.2.00.0070.00018.23
8.1.280.0140.00425.92
8.1.270.0080.00021.96
8.1.260.0070.00026.35
8.1.250.0050.00228.09
8.1.240.0080.00023.86
8.1.230.0060.00617.75
8.1.220.0040.00417.77
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0090.00018.57
8.1.160.0040.00418.96
8.1.150.0000.00720.21
8.1.140.0040.00419.62
8.1.130.0020.00519.23
8.1.120.0030.00317.53
8.1.110.0020.00517.46
8.1.100.0030.00517.45
8.1.90.0040.00417.38
8.1.80.0030.00517.50
8.1.70.0000.00717.50
8.1.60.0030.00517.49
8.1.50.0040.00717.58
8.1.40.0030.00517.46
8.1.30.0080.00017.53
8.1.20.0080.00017.59
8.1.10.0040.00417.53
8.1.00.0000.00817.44
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0070.00018.46
8.0.270.0040.00417.21
8.0.260.0000.00716.90
8.0.250.0070.00017.02
8.0.240.0000.00817.07
8.0.230.0080.00316.96
8.0.220.0050.00216.98
8.0.210.0030.00317.02
8.0.200.0000.00716.96
8.0.190.0050.00317.07
8.0.180.0060.00317.00
8.0.170.0040.00417.02
8.0.160.0030.00616.95
8.0.150.0070.00016.92
8.0.140.0070.00016.81
8.0.130.0040.00413.39
8.0.120.0000.00716.94
8.0.110.0070.00016.95
8.0.100.0050.00216.87
8.0.90.0070.00016.80
8.0.80.0060.01016.89
8.0.70.0000.00816.76
8.0.60.0040.00416.97
8.0.50.0000.00717.01
8.0.30.0090.01217.18
8.0.20.0160.00517.40
8.0.10.0000.00717.11
8.0.00.0080.01016.84
7.4.330.0050.00015.55
7.4.320.0000.00716.59
7.4.300.0040.00416.58
7.4.290.0030.00316.61
7.4.280.0030.00516.43
7.4.270.0040.00416.54
7.4.260.0040.00416.52
7.4.250.0000.00716.44
7.4.240.0000.00716.52
7.4.230.0000.00716.52
7.4.220.0110.00716.46
7.4.210.0090.00616.68
7.4.200.0030.00616.64
7.4.160.0080.00816.47
7.4.150.0170.00317.40
7.4.140.0120.00817.86
7.4.130.0160.00416.57
7.4.120.0090.01116.49
7.4.110.0140.00316.73
7.4.100.0070.01016.71
7.4.90.0140.00316.65
7.4.80.0160.00619.39
7.4.70.0100.00616.66
7.4.60.0030.01416.41
7.4.50.0110.00716.45
7.4.40.0060.00916.71
7.4.30.0090.00916.50
7.4.00.0060.01215.14
7.3.330.0030.00313.23
7.3.320.0000.00513.38
7.3.310.0070.00016.36
7.3.300.0030.00316.31
7.3.290.0080.00916.25
7.3.280.0080.00916.30
7.3.270.0100.00717.40
7.3.260.0070.01116.36
7.3.240.0140.00816.44
7.3.230.0160.00716.37
7.3.210.0160.00016.32
7.3.200.0150.00316.65
7.3.190.0040.01116.46
7.3.180.0070.01016.50
7.3.170.0030.01316.42
7.3.160.0090.01016.39
7.3.10.0030.01216.69
7.3.00.0070.01116.71
7.2.330.0100.00716.85
7.2.320.0110.01216.82
7.2.310.0030.01516.70
7.2.300.0030.01316.84
7.2.290.0070.01116.43
7.2.130.0030.00617.13
7.2.120.0030.00716.77
7.2.110.0060.00916.97
7.2.100.0000.01416.68
7.2.90.0030.01017.23
7.2.80.0090.00317.14
7.2.70.0100.00716.96
7.2.60.0050.00616.93
7.2.50.0060.00916.78
7.2.40.0000.00917.03
7.2.30.0040.00816.75
7.2.20.0040.01116.85
7.2.10.0030.01016.88
7.2.00.0030.01216.84
7.1.250.0030.01015.54
7.1.200.0070.00715.45
7.1.70.0070.00717.28
7.1.60.0070.00417.18
7.1.50.1400.02332.93
7.1.40.1200.01732.56
7.1.30.1270.01732.53
7.1.20.1330.01332.56
7.1.10.0870.01014.71
7.1.00.1000.01014.70
7.0.200.0060.01016.79
7.0.190.1570.00714.83
7.0.180.1170.01014.42
7.0.170.1230.00714.33
7.0.160.0800.01014.25
7.0.150.0700.01014.39
7.0.140.0800.00314.18
7.0.130.0930.00714.67
7.0.120.0870.01014.58
7.0.110.0830.00714.55
7.0.100.0700.01014.21
7.0.90.0630.01014.36
7.0.80.0900.01014.50
7.0.70.0700.00714.44
7.0.60.0630.01014.06
7.0.50.0670.01014.62
7.0.40.0730.01014.52
7.0.30.0630.01014.59
7.0.20.0600.01014.44
7.0.10.0600.01014.45
7.0.00.0600.01314.30

preferences:
108.57 ms | 401 KiB | 5 Q