3v4l.org

run code in 300+ PHP versions simultaneously
<?php $original_array = [ 0 => [ 'lat' => 40.7587979, 'lon' => -73.9623427 ], 1 => [ 'lat' => 39.8587028, 'lon' => -84.277025 ], 2 => [ 'lat' => 37.7647993, 'lon' => -122.4629897 ], 3 => [ 'lat' => 37.7647993, 'lon' => -122.4629897 ], 4 => [ 'lat' => 33.5125302, 'lon' => -117.6860507 ], 5 => [ 'lat' => 39.8587028, 'lon' => -84.277025 ], ]; // To hold the new array $out = []; // Outer loop over the result from array_count_values() foreach (array_count_values(array_map(function($l) { // Map function combines lat|lng return implode("|", $l); // The rest of the loop syntax... }, $original_array)) as $pair => $count) { // Split the counted array key back to individual lat,lng list($lat, $lng) = explode("|", $pair); // Put it all onto the output array $out[] = [ 'lat' => $lat, 'lng' => $lng, 'count' => $count ]; } print_r($out);

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.10.0100.00818.66
8.5.00.0120.00919.84
8.4.150.0030.00014.05
8.4.140.0110.00917.38
8.4.130.0120.00917.63
8.4.120.0160.00420.72
8.4.110.0080.01019.02
8.4.100.0050.00418.90
8.4.90.0070.00122.46
8.4.80.0050.00418.64
8.4.70.0110.01020.59
8.4.60.0110.00820.35
8.4.50.0060.00418.36
8.4.40.0060.01317.70
8.4.30.0000.00820.41
8.4.20.0030.00717.62
8.4.10.0030.00622.30
8.3.280.0090.01118.43
8.3.270.0120.00816.58
8.3.260.0110.00716.75
8.3.250.0130.00518.91
8.3.240.0090.01016.54
8.3.230.0130.00716.64
8.3.220.0090.01019.16
8.3.210.0090.00816.63
8.3.200.0070.00416.54
8.3.190.0100.01017.26
8.3.180.0040.00518.69
8.3.170.0040.00419.18
8.3.160.0030.01416.62
8.3.150.0120.00616.50
8.3.140.0000.00716.86
8.3.130.0040.00418.61
8.3.120.0120.00618.96
8.3.110.0030.00620.94
8.3.100.0040.00424.06
8.3.90.0070.00026.77
8.3.80.0090.00016.86
8.3.70.0130.00318.30
8.3.60.0100.00716.61
8.3.50.0130.00824.49
8.3.40.0070.00718.68
8.3.30.0120.00318.54
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0130.00520.36
8.2.280.0150.00518.42
8.2.270.0000.00816.57
8.2.260.0080.00017.17
8.2.250.0060.00316.82
8.2.240.0030.00618.65
8.2.230.0080.00022.58
8.2.220.0030.00637.54
8.2.210.0100.00326.77
8.2.200.0090.00916.38
8.2.190.0000.01516.58
8.2.180.0100.00725.92
8.2.170.0110.00718.91
8.2.160.0090.00622.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0040.00426.16
8.2.110.0040.00421.11
8.2.100.0060.00617.68
8.2.90.0000.00817.88
8.2.80.0030.00618.78
8.2.70.0060.00318.16
8.2.60.0000.00818.22
8.2.50.0040.00418.10
8.2.40.0030.00519.30
8.2.30.0040.00419.23
8.2.20.0050.00218.11
8.2.10.0070.00019.35
8.2.00.0040.00419.21
8.1.330.0090.00922.10
8.1.320.0110.01016.22
8.1.310.0030.00518.64
8.1.300.0000.00917.77
8.1.290.0000.00918.88
8.1.280.0040.01225.92
8.1.270.0000.00823.75
8.1.260.0110.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00622.15
8.1.230.0090.00322.63
8.1.220.0060.00317.78
8.1.210.0000.00918.77
8.1.200.0100.00017.35
8.1.190.0030.00517.23
8.1.180.0030.00618.10
8.1.170.0080.00018.54
8.1.160.0000.00718.81
8.1.150.0040.00418.81
8.1.140.0000.00717.48
8.1.130.0040.00419.15
8.1.120.0030.00517.43
8.1.110.0000.00717.36
8.1.100.0000.00817.46
8.1.90.0040.00417.36
8.1.80.0070.00317.34
8.1.70.0040.00417.48
8.1.60.0040.00417.55
8.1.50.0000.00817.41
8.1.40.0000.00717.44
8.1.30.0000.00817.51
8.1.20.0040.00417.65
8.1.10.0000.00817.56
8.1.00.0030.00617.38
8.0.300.0040.00418.77
8.0.290.0050.00316.75
8.0.280.0040.00418.34
8.0.270.0030.00316.81
8.0.260.0000.00718.47
8.0.250.0080.00016.85
8.0.240.0000.00616.90
8.0.230.0070.00016.84
8.0.220.0070.00016.93
8.0.210.0000.00716.88
8.0.200.0070.00016.94
8.0.190.0000.00717.00
8.0.180.0030.00616.87
8.0.170.0000.01116.92
8.0.160.0000.00716.84
8.0.150.0000.00816.80
8.0.140.0080.00416.78
8.0.130.0000.00513.30
8.0.120.0060.00316.73
8.0.110.0000.00716.78
8.0.100.0000.00716.68
8.0.90.0000.00716.83
8.0.80.0070.01416.91
8.0.70.0030.00516.86
8.0.60.0040.00416.88
8.0.50.0000.00816.82
8.0.30.0070.01017.04
8.0.20.0070.01317.07
8.0.10.0090.01216.93
8.0.00.0230.00317.13
7.4.330.0030.00316.85
7.4.320.0030.00316.36
7.4.300.0030.00316.68
7.4.290.0050.00316.54
7.4.280.0080.00016.59
7.4.270.0000.00716.41
7.4.260.0000.00513.28
7.4.250.0000.00716.49
7.4.240.0070.00016.52
7.4.230.0030.00316.40
7.4.220.0020.00516.47
7.4.210.0070.00816.55
7.4.200.0000.00816.38
7.4.150.0110.00716.56
7.4.140.0100.01416.40
7.4.130.0090.01216.47
7.4.120.0090.00916.73
7.4.110.0090.00916.30
7.4.100.0070.01016.58
7.4.90.0120.01216.44
7.4.80.0150.00416.38
7.4.70.0080.01116.14
7.4.60.0040.01416.31
7.4.50.0060.01316.31
7.4.40.0060.01816.37
7.4.30.0090.00916.39
7.4.20.0090.00916.09
7.4.10.0060.01216.45
7.4.00.0030.01416.40
7.3.330.0000.00716.10
7.3.320.0000.00613.32
7.3.310.0070.00016.19
7.3.300.0080.00016.25
7.3.290.0030.00316.18
7.3.270.0120.00616.43
7.3.260.0120.00616.50
7.3.250.0100.00816.43
7.3.240.0080.00816.66
7.3.230.0150.00316.48
7.3.220.0060.01216.34
7.3.210.0140.00516.45
7.3.200.0090.00916.17
7.3.190.0030.01316.35
7.3.180.0100.01016.20
7.3.170.0070.01116.34
7.3.160.0040.01416.41
7.3.150.0130.00716.43
7.3.140.0060.01216.49
7.3.130.0110.00716.18
7.3.120.0100.01016.27
7.3.110.0090.00916.51
7.3.100.0190.00016.52
7.3.90.0130.00616.25
7.3.80.0090.00916.24
7.3.70.0060.01216.32
7.3.60.0090.00916.46
7.3.50.0040.01516.27
7.3.40.0060.01316.39
7.3.30.0140.01016.34
7.3.20.0120.00616.32
7.3.10.0000.02416.27
7.3.00.0160.01016.29

preferences:
34.7 ms | 403 KiB | 5 Q