3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fonts = [ [ 'family' => 'Abril Fatface', 'weight' => 'regular', 'charset' => 'latin,latin-ext' ], [ 'family' => 'Akronim', 'weight' => 'regular', 'charset' => 'latin' ], [ 'family' => 'Akronim', 'weight' => 'regular, bold', 'charset' => 'latin' ], [ 'family' => 'Akronim', 'weight' => 'regular', 'charset' => 'latin,latin-ext' ], [ 'family' => 'Acme', 'weight' => 'regular', 'charset' => 'latin' ] ]; $result = []; foreach ($fonts as $row) { $row['weight'] = array_flip(preg_split('~, ?~', $row['weight'], 0, PREG_SPLIT_NO_EMPTY)); $row['charset'] = array_flip(preg_split('~, ?~', $row['charset'], 0, PREG_SPLIT_NO_EMPTY)); if (!isset($result[$row['family']])) { $result[$row['family']] = $row; } else { $result[$row['family']]['weight'] += $row['weight']; $result[$row['family']]['charset'] += $row['charset']; } } foreach ($result as &$row) { $row['weight'] = implode(',', array_keys($row['weight'])); $row['charset'] = implode(',', array_keys($row['charset'])); } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 47
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 47
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 47
2 jumps found. (Code = 125) Position 1 = 49, Position 2 = 71
Branch analysis from position: 49
2 jumps found. (Code = 126) Position 1 = 50, Position 2 = 71
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
Branch analysis from position: 47
filename:       /in/GTdQk
function name:  (null)
number of ops:  79
compiled vars:  !0 = $fonts, !1 = $result, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   31     1        ASSIGN                                                   !1, <array>
   32     2      > FE_RESET_R                                       $5      !0, ->47
          3    > > FE_FETCH_R                                               $5, !2, ->47
   33     4    >   INIT_FCALL                                               'array_flip'
          5        INIT_FCALL                                               'preg_split'
          6        SEND_VAL                                                 '%7E%2C+%3F%7E'
          7        FETCH_DIM_R                                      ~7      !2, 'weight'
          8        SEND_VAL                                                 ~7
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                         $9      
         14        ASSIGN_DIM                                               !2, 'weight'
         15        OP_DATA                                                  $9
   34    16        INIT_FCALL                                               'array_flip'
         17        INIT_FCALL                                               'preg_split'
         18        SEND_VAL                                                 '%7E%2C+%3F%7E'
         19        FETCH_DIM_R                                      ~11     !2, 'charset'
         20        SEND_VAL                                                 ~11
         21        SEND_VAL                                                 0
         22        SEND_VAL                                                 1
         23        DO_ICALL                                         $12     
         24        SEND_VAR                                                 $12
         25        DO_ICALL                                         $13     
         26        ASSIGN_DIM                                               !2, 'charset'
         27        OP_DATA                                                  $13
   35    28        FETCH_DIM_R                                      ~14     !2, 'family'
         29        ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !1, ~14
         30        BOOL_NOT                                         ~16     ~15
         31      > JMPZ                                                     ~16, ->36
   36    32    >   FETCH_DIM_R                                      ~17     !2, 'family'
         33        ASSIGN_DIM                                               !1, ~17
         34        OP_DATA                                                  !2
   35    35      > JMP                                                      ->46
   38    36    >   FETCH_DIM_R                                      ~19     !2, 'family'
         37        FETCH_DIM_R                                      ~22     !2, 'weight'
         38        FETCH_DIM_RW                                     $20     !1, ~19
         39        ASSIGN_DIM_OP                +=               1          $20, 'weight'
         40        OP_DATA                                                  ~22
   39    41        FETCH_DIM_R                                      ~23     !2, 'family'
         42        FETCH_DIM_R                                      ~26     !2, 'charset'
         43        FETCH_DIM_RW                                     $24     !1, ~23
         44        ASSIGN_DIM_OP                +=               1          $24, 'charset'
         45        OP_DATA                                                  ~26
   32    46    > > JMP                                                      ->3
         47    >   FE_FREE                                                  $5
   42    48      > FE_RESET_RW                                      $27     !1, ->71
         49    > > FE_FETCH_RW                                              $27, !2, ->71
   43    50    >   INIT_FCALL                                               'implode'
         51        SEND_VAL                                                 '%2C'
         52        INIT_FCALL                                               'array_keys'
         53        FETCH_DIM_R                                      ~29     !2, 'weight'
         54        SEND_VAL                                                 ~29
         55        DO_ICALL                                         $30     
         56        SEND_VAR                                                 $30
         57        DO_ICALL                                         $31     
         58        ASSIGN_DIM                                               !2, 'weight'
         59        OP_DATA                                                  $31
   44    60        INIT_FCALL                                               'implode'
         61        SEND_VAL                                                 '%2C'
         62        INIT_FCALL                                               'array_keys'
         63        FETCH_DIM_R                                      ~33     !2, 'charset'
         64        SEND_VAL                                                 ~33
         65        DO_ICALL                                         $34     
         66        SEND_VAR                                                 $34
         67        DO_ICALL                                         $35     
         68        ASSIGN_DIM                                               !2, 'charset'
         69        OP_DATA                                                  $35
   42    70      > JMP                                                      ->49
         71    >   FE_FREE                                                  $27
   46    72        INIT_FCALL                                               'var_export'
         73        INIT_FCALL                                               'array_values'
         74        SEND_VAR                                                 !1
         75        DO_ICALL                                         $36     
         76        SEND_VAR                                                 $36
         77        DO_ICALL                                                 
         78      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.06 ms | 1008 KiB | 19 Q