3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $prop = "Test"; function run() { foreach ($this as $k => $v) { echo "$k => $v\n"; } var_dump(get_object_vars($this)); } } class Test2 extends Test { public $prop = "Test2"; } (new Test2)->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BdLXQ
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $0      'Test2'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'run'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class Test:
Function run:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/BdLXQ
function name:  run
number of ops:  19
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_THIS                                       ~2      
          1      > FE_RESET_R                                       $3      ~2, ->10
          2    > > FE_FETCH_R                                       ~4      $3, !0, ->10
          3    >   ASSIGN                                                   !1, ~4
    7     4        ROPE_INIT                                     4  ~7      !1
          5        ROPE_ADD                                      1  ~7      ~7, '+%3D%3E+'
          6        ROPE_ADD                                      2  ~7      ~7, !0
          7        ROPE_END                                      3  ~6      ~7, '%0A'
          8        ECHO                                                     ~6
    6     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $3
    9    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'get_object_vars'
         13        FETCH_THIS                                       ~9      
         14        SEND_VAL                                                 ~9
         15        DO_ICALL                                         $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                                 
   10    18      > RETURN                                                   null

End of function run

End of class Test.

Class Test2:
Function run:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/BdLXQ
function name:  run
number of ops:  19
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_THIS                                       ~2      
          1      > FE_RESET_R                                       $3      ~2, ->10
          2    > > FE_FETCH_R                                       ~4      $3, !0, ->10
          3    >   ASSIGN                                                   !1, ~4
    7     4        ROPE_INIT                                     4  ~7      !1
          5        ROPE_ADD                                      1  ~7      ~7, '+%3D%3E+'
          6        ROPE_ADD                                      2  ~7      ~7, !0
          7        ROPE_END                                      3  ~6      ~7, '%0A'
          8        ECHO                                                     ~6
    6     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $3
    9    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'get_object_vars'
         13        FETCH_THIS                                       ~9      
         14        SEND_VAL                                                 ~9
         15        DO_ICALL                                         $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                                 
   10    18      > RETURN                                                   null

End of function run

End of class Test2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.66 ms | 1400 KiB | 17 Q