3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Shiterator implements Iterator { private $_array = array(); public function __construct(array $array) { $this->_array = $array; } public function rewind() { reset($this->_array); } public function current() { return current($this->_array); } public function key() { return key($this->_array); } public function next() { next($this->_array); } public function valid() { return $this->key() !== null; } } $i = new myIterator; foreach ($i as $t) { echo $t; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/kLriq
function name:  (null)
number of ops:  10
compiled vars:  !0 = $i, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'shiterator'
   30     1        NEW                                              $2      'myIterator'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   32     4      > FE_RESET_R                                       $5      !0, ->8
          5    > > FE_FETCH_R                                               $5, !1, ->8
   33     6    >   ECHO                                                     !1
   32     7      > JMP                                                      ->5
          8    >   FE_FREE                                                  $5
   34     9      > RETURN                                                   1

Class Shiterator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kLriq
function name:  __construct
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               '_array'
          2        OP_DATA                                                  !0
    7     3      > 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/kLriq
function name:  rewind
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'reset'
          1        FETCH_OBJ_W                                      $0      '_array'
          2        SEND_REF                                                 $0
          3        DO_ICALL                                                 
   11     4      > RETURN                                                   null

End of function rewind

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kLriq
function name:  current
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'current'
          1        FETCH_OBJ_R                                      ~0      '_array'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   15     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/kLriq
function name:  key
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'key'
          1        FETCH_OBJ_R                                      ~0      '_array'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   19     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/kLriq
function name:  next
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'next'
          1        FETCH_OBJ_W                                      $0      '_array'
          2        SEND_REF                                                 $0
          3        DO_ICALL                                                 
   23     4      > 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/kLriq
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_METHOD_CALL                                         'key'
          1        DO_FCALL                                      0  $0      
          2        TYPE_CHECK                                  1020  ~1      $0
          3      > RETURN                                                   ~1
   27     4*     > RETURN                                                   null

End of function valid

End of class Shiterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.66 ms | 1400 KiB | 21 Q