3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stops = Array ( 0 => Array ( 'agency_stop_id' => 1, 'routes' => Array ( '_ids' => Array (0 => 'Route 1', 1 => 'Route 2' ))), 1 => Array ( 'agency_stop_id' => 5, 'routes' => Array ( '_ids' => Array (0 => 'Route 1', 1 => 'Route 2' ))), 2 => Array ( 'agency_stop_id' => 5, 'routes' => Array ( '_ids' => Array (0 => 'Route 3', 1 => 'Route 4' ))), ); $out = []; $stops = array_unique($stops, SORT_REGULAR); $stopids = array_unique(array_column($stops, 'agency_stop_id')); foreach ($stopids as $stopid) { $keys = array_keys(array_column($stops, 'agency_stop_id'), $stopid); //Create an array of the matching stops foreach ($keys as $key) { $stop = array_map( function ($k) use ($stops) { return $stops[$k]; }, $key ); } //print_r($stop); //if there is only one if (count($stop) == 1) { //save array to $out $out[] = $stop[0]; //if there is more then one } elseif (count($keys) > 1) { $stop = array_merge_recursive($stop[0], [ 'routes' => $stop[1]['routes']]); $out[] = $stop; } } print_r($out); #print_r($new_array[0]); #print_r(Array( 'routes' => $new_array[1]['routes']));

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.0120.00620.26
8.5.00.0140.00820.19
8.4.150.0020.00014.05
8.4.140.0100.01117.64
8.4.130.0150.00619.56
8.4.120.0150.00520.49
8.4.110.0120.01022.27
8.4.100.0110.01018.71
8.4.90.0120.00818.72
8.4.80.0080.00118.92
8.4.70.0080.00719.77
8.4.60.0040.00618.73
8.4.50.0050.00318.63
8.4.40.0080.00317.73
8.4.30.0040.00418.75
8.4.20.0180.00417.60
8.4.10.0070.00317.70
8.3.280.0110.00918.52
8.3.270.0110.00916.72
8.3.260.0150.00416.86
8.3.250.0130.00719.02
8.3.240.0050.00417.30
8.3.230.0100.00316.50
8.3.220.0050.00318.72
8.3.210.0090.00816.86
8.3.200.0040.00416.66
8.3.190.0140.00617.13
8.3.180.0100.00816.54
8.3.170.0160.00620.50
8.3.160.0000.00917.33
8.3.150.0180.00017.38
8.3.140.0060.01216.80
8.3.130.0080.00018.48
8.3.120.0080.00418.85
8.3.110.0050.00318.38
8.3.100.0090.00016.77
8.3.90.0040.00426.77
8.3.80.0040.00818.30
8.3.70.0090.00616.50
8.3.60.0070.00716.88
8.3.50.0100.00921.09
8.3.40.0150.00018.78
8.3.30.0070.01118.84
8.3.20.0000.00720.20
8.3.10.0070.00023.66
8.3.00.0080.00022.58
8.2.290.0050.01320.56
8.2.280.0120.00719.97
8.2.270.0040.01419.13
8.2.260.0080.00616.90
8.2.250.0110.00718.67
8.2.240.0090.00918.82
8.2.230.0050.00320.94
8.2.220.0060.00324.06
8.2.210.0070.00726.77
8.2.200.0060.00318.38
8.2.190.0070.00716.88
8.2.180.0140.00716.75
8.2.170.0180.00422.96
8.2.160.0140.00022.17
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00422.25
8.2.120.0040.00426.35
8.2.110.0030.00621.00
8.2.100.0180.00017.91
8.2.90.0000.00819.05
8.2.80.0050.00317.97
8.2.70.0050.00317.50
8.2.60.0080.00018.04
8.2.50.0030.00618.10
8.2.40.0000.00820.65
8.2.30.0000.00719.31
8.2.20.0000.00817.78
8.2.10.0050.00318.03
8.2.00.0050.00217.72
8.1.330.0100.00821.91
8.1.320.0110.01116.40
8.1.310.0090.00916.85
8.1.300.0130.00616.84
8.1.290.0080.00330.84
8.1.280.0150.00625.92
8.1.270.0040.00423.92
8.1.260.0080.00028.09
8.1.250.0040.00428.09
8.1.240.0000.01023.82
8.1.230.0040.00720.14
8.1.220.0080.00017.75
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0060.00317.23
8.1.180.0030.00518.10
8.1.170.0080.00018.59
8.1.160.0000.00822.09
8.1.150.0030.00518.95
8.1.140.0000.00719.51
8.1.130.0040.00417.68
8.1.120.0070.00017.50
8.1.110.0030.00517.45
8.1.100.0000.00817.36
8.1.90.0040.00417.50
8.1.80.0000.00817.48
8.1.70.0040.00417.48
8.1.60.0080.00017.49
8.1.50.0090.00017.43
8.1.40.0090.00317.43
8.1.30.0060.00617.57
8.1.20.0040.00417.71
8.1.10.0030.00617.58
8.1.00.0040.00417.56
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0030.00518.36
8.0.270.0040.00417.16
8.0.260.0030.00317.39
8.0.250.0000.00717.01
8.0.240.0030.00317.07
8.0.230.0000.00817.00
8.0.220.0000.00816.84
8.0.210.0050.00316.82
8.0.200.0030.00317.04
8.0.190.0030.00517.05
8.0.180.0030.00517.00
8.0.170.0040.00416.89
8.0.160.0000.00716.95
8.0.150.0000.00716.83
8.0.140.0080.00016.75
8.0.130.0030.00513.29
8.0.120.0000.00816.98
8.0.110.0040.00416.86
8.0.100.0000.00716.83
8.0.90.0040.00416.95
8.0.80.0090.00616.98
8.0.70.0030.00517.00
8.0.60.0000.00816.94
8.0.50.0070.00016.75
8.0.30.0060.01217.10
8.0.20.0090.00917.40
8.0.10.0040.00417.15
8.0.00.0100.00716.78
7.4.330.0020.00216.66
7.4.320.0030.00316.60
7.4.300.0020.00516.61
7.4.290.0040.00416.47
7.4.280.0050.00316.40
7.4.270.0000.00716.62
7.4.260.0040.00416.54
7.4.250.0080.00016.57
7.4.240.0060.00316.58
7.4.230.0040.00416.59
7.4.220.0110.00616.54
7.4.210.0090.00616.63
7.4.200.0040.00416.54
7.4.160.0090.00716.50
7.4.150.0100.01417.40
7.4.140.0120.01017.86
7.4.130.0130.00716.63
7.4.120.0060.01116.59
7.4.110.0190.00016.64
7.4.100.0110.01116.67
7.4.90.0100.00716.47
7.4.80.0160.01019.39
7.4.70.0030.01316.64
7.4.60.0100.00716.50
7.4.50.0040.01216.58
7.4.40.0140.00516.48
7.4.30.0040.01216.74
7.4.10.0090.00916.54
7.4.00.0110.00515.42
7.3.330.0030.00313.42
7.3.320.0060.00013.45
7.3.310.0030.00316.40
7.3.300.0000.00716.44
7.3.290.0030.00316.29
7.3.280.0040.01116.40
7.3.270.0090.00917.40
7.3.260.0080.00816.56
7.3.250.0060.01216.48
7.3.240.0090.00916.63
7.3.230.0090.00916.39
7.3.210.0120.00416.34
7.3.200.0030.01316.39
7.3.190.0000.01616.56
7.3.180.0060.01516.52
7.3.170.0090.01416.61
7.3.160.0150.00316.50
7.3.130.0140.00716.68
7.3.120.0100.00815.34
7.3.110.0060.01115.25
7.3.100.0070.01115.11
7.3.90.0060.00815.34
7.3.80.0050.01015.27
7.3.70.0010.01215.20
7.3.60.0050.00915.19
7.3.50.0070.00515.27
7.3.40.0050.00815.25
7.3.30.0040.01115.14
7.3.20.0050.00717.04
7.3.10.0090.00316.92
7.3.00.0030.01116.89
7.2.330.0070.01116.48
7.2.320.0140.00316.80
7.2.310.0120.00616.75
7.2.300.0100.00716.74
7.2.290.0080.00816.53
7.2.260.0100.00716.64
7.2.250.0070.01215.50
7.2.240.0050.01215.45
7.2.230.0060.00715.45
7.2.220.0070.00715.45
7.2.210.0060.01015.57
7.2.200.0020.01215.50
7.2.190.0050.00915.37
7.2.180.0050.00915.46
7.2.170.0060.01015.33
7.2.160.0080.00315.33
7.2.150.0090.00517.27
7.2.140.0020.01217.43
7.2.130.0060.00917.04
7.2.120.0080.00717.11
7.2.110.0050.00917.12
7.2.100.0060.01017.10
7.2.90.0070.00917.10
7.2.80.0060.01117.17
7.2.70.0110.00517.23
7.2.60.0090.00617.04
7.2.50.0100.00717.15
7.2.40.0090.00717.13
7.2.30.0060.01017.15
7.2.20.0080.00917.08
7.2.10.0080.00817.06
7.2.00.0050.01117.54
7.1.330.0060.01116.22
7.1.320.0020.01016.16
7.1.310.0050.00616.10
7.1.300.0080.00516.25
7.1.290.0050.00916.12
7.1.280.0040.00616.15
7.1.270.0070.00916.22
7.1.260.0080.00616.26
7.1.250.0050.00916.04
7.1.240.0050.00716.24
7.1.230.0050.00916.18
7.1.220.0040.00716.15
7.1.210.0060.00616.27
7.1.200.0030.01016.08
7.1.190.0060.00716.14
7.1.180.0030.01016.10
7.1.170.0050.00816.08
7.1.160.0050.00716.22
7.1.150.0060.00916.30
7.1.140.0080.00516.24
7.1.130.0020.00816.21
7.1.120.0050.00816.21
7.1.110.0060.00816.24
7.1.100.0030.01016.52
7.1.90.0050.00816.28
7.1.80.0060.00716.22
7.1.70.0070.00716.38
7.1.60.0070.00516.42
7.1.50.0080.00716.41
7.1.40.0070.00816.31
7.1.30.0050.00816.26
7.1.20.0040.00816.17
7.1.10.0050.00816.15
7.1.00.0050.02117.50
7.0.330.0070.00415.73
7.0.320.0060.00515.81
7.0.310.0050.00615.71
7.0.300.0060.00615.72
7.0.290.0030.00915.91
7.0.280.0060.00715.88
7.0.270.0060.00915.71
7.0.260.0050.00615.78
7.0.250.0070.00415.86
7.0.240.0030.00815.82
7.0.230.0030.00915.81
7.0.220.0070.00715.78
7.0.210.0050.00815.74
7.0.200.0050.00715.61
7.0.190.0030.00915.76
7.0.180.0060.00615.87
7.0.170.0060.00715.85
7.0.160.0050.00715.80
7.0.150.0030.00915.95
7.0.140.0060.00615.72
7.0.130.0050.00715.78
7.0.120.0040.00915.78
7.0.110.0040.02516.69
7.0.100.0090.01216.53
7.0.90.0060.02116.69
7.0.80.0070.01816.70
7.0.70.0050.01816.59
7.0.60.0050.01916.65
7.0.50.0060.01916.71
7.0.40.0070.01715.08
7.0.30.0040.02015.19
7.0.20.0170.02015.17
7.0.10.0110.01715.16
7.0.00.0140.01415.10
5.6.400.0030.00714.69
5.6.390.0020.01014.77
5.6.380.0030.01014.97
5.6.370.0050.00514.97
5.6.360.0050.00914.92
5.6.350.0030.00714.62
5.6.340.0040.00914.90
5.6.330.0060.00814.97
5.6.320.0050.00814.77
5.6.310.0060.00914.69
5.6.300.0020.01014.79
5.6.290.0050.00714.92
5.6.280.0040.00915.00
5.6.270.0040.00915.00
5.6.260.0050.02416.00
5.6.250.0050.01915.98
5.6.240.0090.02016.07
5.6.230.0060.01816.02
5.6.220.0050.01815.95
5.6.210.0090.01616.00
5.6.200.0070.01816.08
5.6.190.0080.01816.12
5.6.180.0080.01716.00
5.6.170.0060.01816.02
5.6.160.0070.01816.13
5.6.150.0120.01716.13
5.6.140.0070.01816.13
5.6.130.0060.01816.06
5.6.120.0050.02116.11
5.6.110.0090.02016.13
5.6.100.0080.01916.10
5.6.90.0070.01915.96
5.6.80.0070.01715.89
5.6.70.0060.01915.82
5.6.60.0060.01915.91
5.6.50.0050.01715.81
5.6.40.0060.01815.93
5.6.30.0050.02315.88
5.6.20.0090.02015.88
5.6.10.0070.01515.88
5.6.00.0070.01515.91

preferences:
167.71 ms | 403 KiB | 5 Q