3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myIterator implements Iterator { public $bar = [5, 4, 3, 2, 1]; public function valid() { return $this->key() !== null; } public function current() { return current($this->bar); } public function key() { return key($this->bar); } public function next() { return next($this->bar); } public function rewind() { rewind($this->bar); } } $it = new myIterator(); while ($it->valid()) { var_dump($it->current()); $it->next(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
Branch analysis from position: 5
filename:       /in/bmUvv
function name:  (null)
number of ops:  16
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'myiterator'
   28     1        NEW                                              $1      'myIterator'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   29     4      > JMP                                                      ->12
   31     5    >   INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   32    10        INIT_METHOD_CALL                                         !0, 'next'
         11        DO_FCALL                                      0          
   29    12    >   INIT_METHOD_CALL                                         !0, 'valid'
         13        DO_FCALL                                      0  $7      
         14      > JMPNZ                                                    $7, ->5
   33    15    > > RETURN                                                   1

Class myIterator:
Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmUvv
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_METHOD_CALL                                         'key'
          1        DO_FCALL                                      0  $0      
          2        TYPE_CHECK                                  1020  ~1      $0
          3      > RETURN                                                   ~1
    9     4*     > RETURN                                                   null

End of function valid

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmUvv
function name:  current
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'current'
          1        FETCH_OBJ_R                                      ~0      'bar'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   13     5*     > RETURN                                                   null

End of function current

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmUvv
function name:  key
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'key'
          1        FETCH_OBJ_R                                      ~0      'bar'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   17     5*     > RETURN                                                   null

End of function key

Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmUvv
function name:  next
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'next'
          1        FETCH_OBJ_W                                      $0      'bar'
          2        SEND_REF                                                 $0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   21     5*     > RETURN                                                   null

End of function next

Function rewind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmUvv
function name:  rewind
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'rewind'
          1        FETCH_OBJ_R                                      ~0      'bar'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   25     4      > RETURN                                                   null

End of function rewind

End of class myIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.98 ms | 1011 KiB | 18 Q