3v4l.org

run code in 300+ PHP versions simultaneously
<?php $config = ['legendaryName' => 'legendary_name']; $data = ['legendary_name' => 'The Hammer']; class Warrior { use DbHydrate; private $legendaryName; } trait DbHydrate { public function hydrate($config, $data) { foreach($config as $attributeName => $column) { $attribute = $this->{$attributeName}; var_dump(isset($attribute)); $this->{$attributeName} = $data[$column]; } } } $legendaryWarrior = new Warrior; $legendaryWarrior->hydrate($config, $data); var_dump($legendaryWarrior); $config = ['classicalName' => 'classical_name']; $data = ['classical_name' => 'John']; $testWarrior = new Warrior; $testWarrior->hydrate($config, $data); var_dump($testWarrior);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LYKT0
function name:  (null)
number of ops:  26
compiled vars:  !0 = $config, !1 = $data, !2 = $legendaryWarrior, !3 = $testWarrior
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    7     2        DECLARE_CLASS                                            'warrior'
   24     3        NEW                                              $6      'Warrior'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $6
   25     6        INIT_METHOD_CALL                                         !2, 'hydrate'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
   26    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   28    13        ASSIGN                                                   !0, <array>
   30    14        ASSIGN                                                   !1, <array>
   32    15        NEW                                              $13     'Warrior'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !3, $13
   33    18        INIT_METHOD_CALL                                         !3, 'hydrate'
         19        SEND_VAR_EX                                              !0
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0          
   34    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class Warrior: [no user functions]
Class DbHydrate:
Function hydrate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/LYKT0
function name:  hydrate
number of ops:  17
compiled vars:  !0 = $config, !1 = $data, !2 = $column, !3 = $attributeName, !4 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2      > FE_RESET_R                                       $5      !0, ->15
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->15
          4    >   ASSIGN                                                   !3, ~6
   17     5        FETCH_OBJ_R                                      ~8      !3
          6        ASSIGN                                                   !4, ~8
   18     7        INIT_FCALL                                               'var_dump'
          8        ISSET_ISEMPTY_CV                                 ~10     !4
          9        SEND_VAL                                                 ~10
         10        DO_ICALL                                                 
   19    11        FETCH_DIM_R                                      ~13     !1, !2
         12        ASSIGN_OBJ                                               !3
         13        OP_DATA                                                  ~13
   16    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $5
   21    16      > RETURN                                                   null

End of function hydrate

End of class DbHydrate.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.16 ms | 1400 KiB | 15 Q