3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function doForeach() { foreach($this as $bar) { $this->x($bar); } } public function doMap() { array_map(array($this, "x"), (array) $this); } private function x($a) { var_dump($a); } } $foo = new Foo; $foo->bar = 'hello'; $foo->baz = 'world'; $foo->doForeach(); $foo->doMap();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cBv91
function name:  (null)
number of ops:  12
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        ASSIGN_OBJ                                               !0, 'bar'
          4        OP_DATA                                                  'hello'
   24     5        ASSIGN_OBJ                                               !0, 'baz'
          6        OP_DATA                                                  'world'
   25     7        INIT_METHOD_CALL                                         !0, 'doForeach'
          8        DO_FCALL                                      0          
   26     9        INIT_METHOD_CALL                                         !0, 'doMap'
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class Foo:
Function doforeach:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/cBv91
function name:  doForeach
number of ops:  9
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       ~1      
          1      > FE_RESET_R                                       $2      ~1, ->7
          2    > > FE_FETCH_R                                               $2, !0, ->7
    9     3    >   INIT_METHOD_CALL                                         'x'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
    7     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $2
   11     8      > RETURN                                                   null

End of function doforeach

Function domap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cBv91
function name:  doMap
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'array_map'
          1        FETCH_THIS                                       ~0      
          2        INIT_ARRAY                                       ~1      ~0
          3        ADD_ARRAY_ELEMENT                                ~1      'x'
          4        SEND_VAL                                                 ~1
          5        FETCH_THIS                                       ~2      
          6        CAST                                          7  ~3      ~2
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                                 
   15     9      > RETURN                                                   null

End of function domap

Function x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cBv91
function name:  x
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   19     4      > RETURN                                                   null

End of function x

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.46 ms | 1400 KiB | 17 Q