3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["division" => "division1"], ["division" => "division2"], ["division" => "division1", "department" => "department10"], ["division" => "division1", "department" => null, "team" => "team91"], ["division" => "division1", "department" => "department10", "team" => "team85"], ["division" => "division3", "department" => "department999"], ["division" => "division2", "department" => "department33"], ["division" => "division1", "department" => null, "team" => "team92"] ]; array_multisort(array_map('count', $array), SORT_DESC, $array); $result = []; foreach ($array as $row) { foreach ($result as $saved) { if (!array_diff_assoc($row, $saved)) { continue 2; } } $result[] = $row; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 28
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 24
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 24
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/AntFS
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $saved
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'array_multisort'
          2        INIT_FCALL                                               'array_map'
          3        SEND_VAL                                                 'count'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        SEND_VAL                                                 $5
          7        SEND_VAL                                                 3
          8        SEND_REF                                                 !0
          9        DO_ICALL                                                 
   15    10        ASSIGN                                                   !1, <array>
   16    11      > FE_RESET_R                                       $8      !0, ->28
         12    > > FE_FETCH_R                                               $8, !2, ->28
   17    13    > > FE_RESET_R                                       $9      !1, ->24
         14    > > FE_FETCH_R                                               $9, !3, ->24
   18    15    >   INIT_FCALL                                               'array_diff_assoc'
         16        SEND_VAR                                                 !2
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $10     
         19        BOOL_NOT                                         ~11     $10
         20      > JMPZ                                                     ~11, ->23
   19    21    >   FE_FREE                                                  $9
         22      > JMP                                                      ->12
   17    23    > > JMP                                                      ->14
         24    >   FE_FREE                                                  $9
   22    25        ASSIGN_DIM                                               !1
         26        OP_DATA                                                  !2
   16    27      > JMP                                                      ->12
         28    >   FE_FREE                                                  $8
   24    29        INIT_FCALL                                               'var_export'
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.35 ms | 1002 KiB | 17 Q