3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'category_id' => 1, 'question_id' => 1, 'option_id' => 2, 'title' => 'Do you wear glasses?', 'answer' => 'no' ], [ 'category_id' => 1, 'question_id' => 2, 'option_id' => 3, 'title' => 'Your hobbies ?', 'answer' => 'movies' ], [ 'category_id' => 1, 'question_id' => 4, 'option_id' => 8, 'title' => 'what is your status?', 'answer' => 'single' ], [ 'category_id' => 1, 'question_id' => 2, 'option_id' => 1, 'title' => 'Your hobbies ?', 'answer' => 'travel' ], ]; $result = []; foreach ($array as $row) { $compositeKey = $row['category_id'] . '_' . $row['question_id']; if (!isset($result[$compositeKey])) { $result[$compositeKey] = $row; } else { $result[$compositeKey]['answer'] .= ",{$row['answer']}"; } } var_export( array_values( $result ) );

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.4.140.0110.00817.64
8.4.130.0060.00517.78
8.4.120.0090.00720.61
8.4.110.0120.00822.38
8.4.100.0130.00619.47
8.4.90.0130.00818.58
8.4.80.0120.00817.88
8.4.70.0060.00318.10
8.4.60.0130.00420.67
8.4.50.0100.00918.84
8.4.40.0070.01420.62
8.4.30.0130.00620.24
8.4.20.0170.00319.30
8.4.10.0050.00322.07
8.3.270.0140.00716.90
8.3.260.0090.00816.68
8.3.250.0140.00518.86
8.3.240.0130.00818.85
8.3.230.0160.00316.66
8.3.220.0050.00517.42
8.3.210.0100.01016.84
8.3.200.0080.00816.91
8.3.190.0100.00918.37
8.3.180.0100.00916.65
8.3.170.0130.00618.90
8.3.160.0050.00518.37
8.3.150.0030.00616.59
8.3.140.0080.00018.83
8.3.130.0060.00318.27
8.3.120.0030.00619.01
8.3.110.0080.00020.94
8.3.100.0150.00424.06
8.3.90.0050.00326.77
8.3.80.0060.00318.55
8.3.70.0100.00716.58
8.3.60.0060.01216.73
8.3.50.0040.01119.98
8.3.40.0100.00321.86
8.3.30.0160.00618.85
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0100.00920.29
8.2.280.0060.00816.61
8.2.270.0110.00618.93
8.2.260.0030.00618.43
8.2.250.0060.00916.54
8.2.240.0160.00318.83
8.2.230.0040.00422.58
8.2.220.0060.00337.54
8.2.210.0110.00326.77
8.2.200.0000.00916.50
8.2.190.0070.00716.75
8.2.180.0160.00325.92
8.2.170.0070.00718.91
8.2.160.0000.01322.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0000.00820.75
8.2.110.0040.00422.31
8.2.100.0090.00317.71
8.2.90.0050.00317.75
8.2.80.0040.00418.75
8.2.70.0000.01017.50
8.2.60.0000.00918.03
8.2.50.0000.00918.07
8.2.40.0040.00418.19
8.2.30.0050.00318.01
8.2.20.0050.00220.49
8.2.10.0070.00318.10
8.2.00.0060.00619.21
8.1.330.0120.00621.89
8.1.320.0100.01016.19
8.1.310.0040.00418.19
8.1.300.0080.00018.52
8.1.290.0000.00830.84
8.1.280.0120.00825.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00023.85
8.1.230.0090.00320.85
8.1.220.0000.00917.78
8.1.210.0050.00518.77
8.1.200.0000.01017.35
8.1.190.0000.00817.25
8.1.180.0060.00318.10
8.1.170.0090.00018.55
8.1.160.0050.00218.93
8.1.150.0070.00018.62
8.1.140.0080.00017.46
8.1.130.0030.00318.75
8.1.120.0040.00417.35
8.1.110.0050.00217.43
8.1.100.0080.00017.45
8.1.90.0040.00417.46
8.1.80.0040.00417.48
8.1.70.0120.00317.44
8.1.60.0140.00417.45
8.1.50.0070.01117.41
8.1.40.0090.00917.53
8.1.30.0130.00417.63
8.1.20.0080.01217.57
8.1.10.0180.00017.44
8.1.00.0040.01417.50
8.0.300.0000.00718.99
8.0.290.0080.00016.75
8.0.280.0030.00318.44
8.0.270.0030.00316.73
8.0.260.0030.00318.43
8.0.250.0030.00616.98
8.0.240.0040.00416.96
8.0.230.0050.00216.83
8.0.220.0040.00416.89
8.0.210.0140.00216.81
8.0.200.0100.00516.79
8.0.190.0150.00016.91
8.0.180.0080.00716.86
8.0.170.0150.00016.68
8.0.160.0070.00616.88
8.0.150.0100.00516.63
8.0.140.0100.00516.81
8.0.130.0130.00316.70
8.0.120.0140.00016.82
8.0.110.0090.00516.79
8.0.100.0110.00416.88
8.0.90.0160.00016.82
8.0.80.0090.00916.83
8.0.70.0080.00816.81
8.0.60.0050.01116.79
8.0.50.0110.00416.77
8.0.30.0070.01016.81
8.0.20.0120.00416.96
8.0.10.0080.00616.91
7.4.330.0000.00515.55
7.4.320.0060.00016.50
7.4.300.0070.00316.55
7.4.290.0080.00316.48
7.4.280.0080.00416.42
7.4.270.0050.00716.47
7.4.260.0060.00616.54
7.4.250.0090.00616.56
7.4.240.0100.00716.45
7.4.230.0070.00516.43
7.4.220.0090.00616.41
7.4.210.0070.00716.49
7.4.200.0060.00616.58
7.4.190.0090.00316.63
7.4.180.0150.00016.43
7.4.160.0080.00816.53
7.4.150.0110.00416.44
7.4.140.0120.00316.25
7.4.130.0140.00016.42
7.4.120.0090.00616.34
7.4.110.0150.00016.41
7.4.100.0120.00316.48
7.4.90.0040.01116.31
7.4.80.0090.00616.32
7.4.70.0100.00316.41
7.4.60.0110.00316.41
7.4.50.0100.00516.35
7.4.40.0110.00416.27
7.4.30.0050.01016.43
7.4.20.0080.00416.31
7.4.10.0130.00016.39
7.4.00.0080.00816.46

preferences:
32.22 ms | 403 KiB | 5 Q