3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Helper { public static function populateCustomMatrices (array $data, array $conf): array { $result = []; foreach ($conf as $groupName => $inclusions) { $isolatedData = array_intersect_key($data, array_flip($inclusions)); for ($i = 0, $max = max(array_map('count', $isolatedData)); $i < $max; ++$i) { foreach ($inclusions as $key) { $result[$groupName][$i][$key] = $isolatedData[$key][$i] ?? 0; } } } return $result; } } $data = [ 'assets' => [1, 2, 3], 'liabilities' => [1, 2, 3, 4, 5, 6], 'equity' => [1], 'income' => [1, 2, 3, 4], 'expenses' => [1, 2, 3] ]; $conf = [ 'balance_sheet' => ['assets', 'liabilities', 'equity'], 'income' => ['income', 'expenses'], ]; var_export(Helper::populateCustomMatrices($data, $conf));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HcHeZ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $data, !1 = $conf
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   28     1        ASSIGN                                                   !1, <array>
   33     2        INIT_FCALL                                               'var_export'
          3        INIT_STATIC_METHOD_CALL                                  'Helper', 'populateCustomMatrices'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class Helper:
Function populatecustommatrices:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 40
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 40
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 24
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 24
Branch analysis from position: 39
Branch analysis from position: 24
Branch analysis from position: 35
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/HcHeZ
function name:  populateCustomMatrices
number of ops:  45
compiled vars:  !0 = $data, !1 = $conf, !2 = $result, !3 = $inclusions, !4 = $groupName, !5 = $isolatedData, !6 = $i, !7 = $max, !8 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ASSIGN                                                   !2, <array>
    8     3      > FE_RESET_R                                       $10     !1, ->40
          4    > > FE_FETCH_R                                       ~11     $10, !3, ->40
          5    >   ASSIGN                                                   !4, ~11
    9     6        INIT_FCALL                                               'array_intersect_key'
          7        SEND_VAR                                                 !0
          8        INIT_FCALL                                               'array_flip'
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $13     
         11        SEND_VAR                                                 $13
         12        DO_ICALL                                         $14     
         13        ASSIGN                                                   !5, $14
   10    14        ASSIGN                                                   !6, 0
         15        INIT_FCALL                                               'max'
         16        INIT_FCALL                                               'array_map'
         17        SEND_VAL                                                 'count'
         18        SEND_VAR                                                 !5
         19        DO_ICALL                                         $17     
         20        SEND_VAR                                                 $17
         21        DO_ICALL                                         $18     
         22        ASSIGN                                                   !7, $18
         23      > JMP                                                      ->37
   11    24    > > FE_RESET_R                                       $20     !3, ->35
         25    > > FE_FETCH_R                                               $20, !8, ->35
   12    26    >   FETCH_DIM_IS                                     ~24     !5, !8
         27        FETCH_DIM_IS                                     ~25     ~24, !6
         28        COALESCE                                         ~26     ~25
         29        QM_ASSIGN                                        ~26     0
         30        FETCH_DIM_W                                      $21     !2, !4
         31        FETCH_DIM_W                                      $22     $21, !6
         32        ASSIGN_DIM                                               $22, !8
         33        OP_DATA                                                  ~26
   11    34      > JMP                                                      ->25
         35    >   FE_FREE                                                  $20
   10    36        PRE_INC                                                  !6
         37    >   IS_SMALLER                                               !6, !7
         38      > JMPNZ                                                    ~28, ->24
    8    39    > > JMP                                                      ->4
         40    >   FE_FREE                                                  $10
   16    41        VERIFY_RETURN_TYPE                                       !2
         42      > RETURN                                                   !2
   17    43*       VERIFY_RETURN_TYPE                                       
         44*     > RETURN                                                   null

End of function populatecustommatrices

End of class Helper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.65 ms | 1020 KiB | 18 Q