3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function getAssociations(array $including = null, array $types = ['hasOne', 'belongsTo', 'hasMany', 'hasAndBelongsToMany']) { // Associations do not store any state, only instanciate once per model base class static $associations = []; $result = []; foreach ($types as $type) { foreach ($this->{$type} as $name => $properties) { if ($including !== null and !isset($including[$name]) and !in_array($name, $including, true)) { continue; } if (!isset($associations[$name])) { $class = 'Model_Association_' . ucfirst($type); $associations[$name] = new $class( $this, $name, $properties ); } $result[$name] = $associations[$name]; } } return $result; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EBuPZ
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E > > RETURN                                                   1

Class Test:
Function getassociations:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 48
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 48
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 46
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 46
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 42
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 42
Branch analysis from position: 23
Branch analysis from position: 15
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 46
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
filename:       /in/EBuPZ
function name:  getAssociations
number of ops:  51
compiled vars:  !0 = $including, !1 = $types, !2 = $associations, !3 = $result, !4 = $type, !5 = $properties, !6 = $name, !7 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      <array>
    6     2        BIND_STATIC                                              !2
    8     3        ASSIGN                                                   !3, <array>
   10     4      > FE_RESET_R                                       $9      !1, ->48
          5    > > FE_FETCH_R                                               $9, !4, ->48
   11     6    >   FETCH_OBJ_R                                      ~10     !4
          7      > FE_RESET_R                                       $11     ~10, ->46
          8    > > FE_FETCH_R                                       ~12     $11, !5, ->46
          9    >   ASSIGN                                                   !6, ~12
   12    10        TYPE_CHECK                                  1020  ~14     !0
         11      > JMPZ_EX                                          ~14     ~14, ->15
   13    12    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !0, !6
         13        BOOL_NOT                                         ~16     ~15
         14        BOOL                                             ~14     ~16
         15    > > JMPZ_EX                                          ~14     ~14, ->23
   14    16    >   INIT_FCALL                                               'in_array'
         17        SEND_VAR                                                 !6
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $17     
         21        BOOL_NOT                                         ~18     $17
         22        BOOL                                             ~14     ~18
         23    > > JMPZ                                                     ~14, ->25
   15    24    > > JMP                                                      ->8
   18    25    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~19     !2, !6
         26        BOOL_NOT                                         ~20     ~19
         27      > JMPZ                                                     ~20, ->42
   19    28    >   INIT_FCALL                                               'ucfirst'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $21     
         31        CONCAT                                           ~22     'Model_Association_', $21
         32        ASSIGN                                                   !7, ~22
   20    33        FETCH_CLASS                                   0  $25     !7
         34        NEW                                              $26     $25
   21    35        FETCH_THIS                                       $27     
         36        SEND_VAR_EX                                              $27
         37        SEND_VAR_EX                                              !6
         38        SEND_VAR_EX                                              !5
         39        DO_FCALL                                      0          
   20    40        ASSIGN_DIM                                               !2, !6
   21    41        OP_DATA                                                  $26
   27    42    >   FETCH_DIM_R                                      ~30     !2, !6
         43        ASSIGN_DIM                                               !3, !6
         44        OP_DATA                                                  ~30
   11    45      > JMP                                                      ->8
         46    >   FE_FREE                                                  $11
   10    47      > JMP                                                      ->5
         48    >   FE_FREE                                                  $9
   31    49      > RETURN                                                   !3
   32    50*     > RETURN                                                   null

End of function getassociations

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.07 ms | 1400 KiB | 17 Q