3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IncrementIterator implements iterator { protected $start; protected $end; protected $current; public function __construct($start, $end) { $this->start = $start; $this->end = $end; } public function rewind() { $this->current = $this->start; } public function valid() { return $this->current <= $this->end; } public function key() { return $this->current; } public function current() { return $this->current; } public function next() { $this->current++; } } $aIterator = new IncrementIterator(0, 26); $bIterator = new IncrementIterator(0, 26); $cIterator = new IncrementIterator(0, 26); $dIterator = new IncrementIterator(0, 26); $multipleIterator = new MultipleIterator(); $multipleIterator->attachIterator($aIterator); $multipleIterator->attachIterator($bIterator); $multipleIterator->attachIterator($cIterator); $multipleIterator->attachIterator($dIterator); foreach ($multipleIterator as $current) { var_dump($current); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 42
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 42
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/TFref
function name:  (null)
number of ops:  44
compiled vars:  !0 = $aIterator, !1 = $bIterator, !2 = $cIterator, !3 = $dIterator, !4 = $multipleIterator, !5 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'incrementiterator'
   33     1        NEW                                              $6      'IncrementIterator'
          2        SEND_VAL_EX                                              0
          3        SEND_VAL_EX                                              26
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $6
   34     6        NEW                                              $9      'IncrementIterator'
          7        SEND_VAL_EX                                              0
          8        SEND_VAL_EX                                              26
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $9
   35    11        NEW                                              $12     'IncrementIterator'
         12        SEND_VAL_EX                                              0
         13        SEND_VAL_EX                                              26
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !2, $12
   36    16        NEW                                              $15     'IncrementIterator'
         17        SEND_VAL_EX                                              0
         18        SEND_VAL_EX                                              26
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !3, $15
   38    21        NEW                                              $18     'MultipleIterator'
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !4, $18
   39    24        INIT_METHOD_CALL                                         !4, 'attachIterator'
         25        SEND_VAR_EX                                              !0
         26        DO_FCALL                                      0          
   40    27        INIT_METHOD_CALL                                         !4, 'attachIterator'
         28        SEND_VAR_EX                                              !1
         29        DO_FCALL                                      0          
   41    30        INIT_METHOD_CALL                                         !4, 'attachIterator'
         31        SEND_VAR_EX                                              !2
         32        DO_FCALL                                      0          
   42    33        INIT_METHOD_CALL                                         !4, 'attachIterator'
         34        SEND_VAR_EX                                              !3
         35        DO_FCALL                                      0          
   44    36      > FE_RESET_R                                       $25     !4, ->42
         37    > > FE_FETCH_R                                               $25, !5, ->42
   45    38    >   INIT_FCALL                                               'var_dump'
         39        SEND_VAR                                                 !5
         40        DO_ICALL                                                 
   44    41      > JMP                                                      ->37
         42    >   FE_FREE                                                  $25
   46    43      > RETURN                                                   1

Class IncrementIterator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TFref
function name:  __construct
number of ops:  7
compiled vars:  !0 = $start, !1 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN_OBJ                                               'start'
          3        OP_DATA                                                  !0
    9     4        ASSIGN_OBJ                                               'end'
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function __construct

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

End of function rewind

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

End of function valid

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TFref
function name:  key
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~0      'current'
          1      > RETURN                                                   ~0
   22     2*     > 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/TFref
function name:  current
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~0      'current'
          1      > RETURN                                                   ~0
   26     2*     > RETURN                                                   null

End of function current

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

End of function next

End of class IncrementIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.96 ms | 1404 KiB | 15 Q