3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo{ public $a; public $b; public $c; public function exchangeArray($data){ $classVariables = get_class_vars(__CLASS__); foreach ( $classVariables as $varName => $varValue ) { $this ->{$varName} = isset($data[$varName]) ? $varValue : NULL; } } } $obj = new foo(); $obj->exchangeArray(array( 'a' => 1, 'b' => 2, 'c' => 3, )); var_dump($obj);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3cued
function name:  (null)
number of ops:  10
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'exchangeArray'
   16     4        SEND_VAL_EX                                              <array>
          5        DO_FCALL                                      0          
   21     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class foo:
Function exchangearray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/3cued
function name:  exchangeArray
number of ops:  18
compiled vars:  !0 = $data, !1 = $classVariables, !2 = $varValue, !3 = $varName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'get_class_vars'
          2        SEND_VAL                                                 'foo'
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    9     5      > FE_RESET_R                                       $6      !1, ->16
          6    > > FE_FETCH_R                                       ~7      $6, !2, ->16
          7    >   ASSIGN                                                   !3, ~7
   10     8        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !3
          9      > JMPZ                                                     ~10, ->12
         10    >   QM_ASSIGN                                        ~11     !2
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~11     null
         13    >   ASSIGN_OBJ                                               !3
         14        OP_DATA                                                  ~11
    9    15      > JMP                                                      ->6
         16    >   FE_FREE                                                  $6
   12    17      > RETURN                                                   null

End of function exchangearray

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.18 ms | 1396 KiB | 17 Q