3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 0 => [ 'regulations_label' => 'Europe', 'groups_label' => 'G1', 'filters_label' => 'FF1' ], 1 => [ 'regulations_label' => 'Europe', 'groups_label' => 'G1', 'filters_label' => 'FF900' ], 2 => [ 'regulations_label' => 'Europe', 'groups_label' => 'G1', 'filters_label' => 'FF324234' ], 3 => [ 'regulations_label' => 'Europe', 'groups_label' => 'G2', 'filters_label' => 'FF23942' ], 4 => [ 'regulations_label' => 'America', 'groups_label' => 'G29', 'filters_label' => 'FF3242' ], 5 => [ 'regulations_label' => 'America', 'groups_label' => 'G29', 'filters_label' => 'FF78978' ], 6 => [ 'regulations_label' => 'America', 'groups_label' => 'G29', 'filters_label' => 'FF48395043' ], 7 => [ 'regulations_label' => 'Asia', 'groups_label' => 'G2000', 'filters_label' => 'FF7' ] ]; $group = []; foreach($data as $v){ $group[$v['regulations_label']][$v['groups_label']][] = $v['filters_label']; } echo '<pre>'; print_r($group);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<pre>Array ( [Europe] => Array ( [G1] => Array ( [0] => FF1 [1] => FF900 [2] => FF324234 ) [G2] => Array ( [0] => FF23942 ) ) [America] => Array ( [G29] => Array ( [0] => FF3242 [1] => FF78978 [2] => FF48395043 ) ) [Asia] => Array ( [G2000] => Array ( [0] => FF7 ) ) )

preferences:
161.54 ms | 404 KiB | 212 Q