3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements Iterator { protected $count = 500; public function next() { $this->count--; } public function valid() { return $this->count > 0; } public function rewind() { $this->count = 500; } public function key() { return null; } public function current() { return $this->count; } } // This one $f = new Foo; foreach($f as $val) { } var_dump($f);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/fm5Io
function name:  (null)
number of ops:  12
compiled vars:  !0 = $f, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   28     1        NEW                                              $2      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   29     4      > FE_RESET_R                                       $5      !0, ->7
          5    > > FE_FETCH_R                                               $5, !1, ->7
          6    > > JMP                                                      ->5
          7    >   FE_FREE                                                  $5
   32     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Foo:
Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fm5Io
function name:  next
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   PRE_DEC_OBJ                                              'count'
    7     1      > RETURN                                                   null

End of function next

Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fm5Io
function name:  valid
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                      ~0      'count'
          1        IS_SMALLER                                       ~1      0, ~0
          2      > RETURN                                                   ~1
   11     3*     > RETURN                                                   null

End of function valid

Function rewind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fm5Io
function name:  rewind
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN_OBJ                                               'count'
          1        OP_DATA                                                  500
   15     2      > RETURN                                                   null

End of function rewind

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fm5Io
function name:  key
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   null
   19     1*     > RETURN                                                   null

End of function key

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fm5Io
function name:  current
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_OBJ_R                                      ~0      'count'
          1      > RETURN                                                   ~0
   23     2*     > RETURN                                                   null

End of function current

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.62 ms | 1400 KiB | 15 Q