3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { private $a = 1; public function t() { var_dump($this->a); var_dump(get_object_vars($this)); } } class A { use T; } $a = new A(); $a->t(); var_dump("loop through object"); foreach ($a as $k => $v) { var_dump($k, $v); } var_dump("loop through object/array"); $a = (array)$a; foreach ($a as $k => $v) { var_dump($k, $v); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 17
filename:       /in/ijhR7
function name:  (null)
number of ops:  33
compiled vars:  !0 = $a, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'a'
   17     1        NEW                                              $3      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   18     4        INIT_METHOD_CALL                                         !0, 't'
          5        DO_FCALL                                      0          
   20     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAL                                                 'loop+through+object'
          8        DO_ICALL                                                 
   22     9      > FE_RESET_R                                       $8      !0, ->17
         10    > > FE_FETCH_R                                       ~9      $8, !1, ->17
         11    >   ASSIGN                                                   !2, ~9
   23    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   22    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $8
   26    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAL                                                 'loop+through+object%2Farray'
         20        DO_ICALL                                                 
   28    21        CAST                                          7  ~13     !0
         22        ASSIGN                                                   !0, ~13
   29    23      > FE_RESET_R                                       $15     !0, ->31
         24    > > FE_FETCH_R                                       ~16     $15, !1, ->31
         25    >   ASSIGN                                                   !2, ~16
   30    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !2
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
   29    30      > JMP                                                      ->24
         31    >   FE_FREE                                                  $15
   31    32      > RETURN                                                   1

Class T:
Function t:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ijhR7
function name:  t
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_R                                      ~0      'a'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    8     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'get_object_vars'
          6        FETCH_THIS                                       ~2      
          7        SEND_VAL                                                 ~2
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
    9    11      > RETURN                                                   null

End of function t

End of class T.

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.53 ms | 1392 KiB | 17 Q