3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CSVFileIterator implements Iterator{ protected $_index = 0; function __construct() { } /** * (PHP 5 >= 5.0.0)<br/> * Return the current element * @link http://php.net/manual/en/iterator.current.php * @return mixed Can return any type. */ public function current() { return $this->_index; } /** * (PHP 5 >= 5.0.0)<br/> * Move forward to next element * @link http://php.net/manual/en/iterator.next.php * @return void Any returned value is ignored. */ public function next() { var_dump('next'); $this->_index++; } /** * (PHP 5 >= 5.0.0)<br/> * Return the key of the current element * @link http://php.net/manual/en/iterator.key.php * @return mixed scalar on success, or null on failure. */ public function key() { var_dump('key'); return $this->_index; } /** * (PHP 5 >= 5.0.0)<br/> * Checks if current position is valid * @link http://php.net/manual/en/iterator.valid.php * @return boolean The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ public function valid() { var_dump('valid'); return $this->_index <5; } /** * (PHP 5 >= 5.0.0)<br/> * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php * @return void Any returned value is ignored. */ public function rewind() { var_dump('rewind'); $this->_index = 0; } } $i = new CSVFileIterator(); foreach ($i as $j) var_dump($j);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/aqc5R
function name:  (null)
number of ops:  12
compiled vars:  !0 = $i, !1 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'csvfileiterator'
   73     1        NEW                                              $2      'CSVFileIterator'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   74     4      > FE_RESET_R                                       $5      !0, ->10
          5    > > FE_FETCH_R                                               $5, !1, ->10
   75     6    >   INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   74     9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $5
   75    11      > RETURN                                                   1

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

End of function __construct

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aqc5R
function name:  current
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      '_index'
          1      > RETURN                                                   ~0
   20     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/aqc5R
function name:  next
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'next'
          2        DO_ICALL                                                 
   31     3        PRE_INC_OBJ                                              '_index'
   32     4      > RETURN                                                   null

End of function next

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

End of function key

Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aqc5R
function name:  valid
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'valid'
          2        DO_ICALL                                                 
   56     3        FETCH_OBJ_R                                      ~1      '_index'
          4        IS_SMALLER                                       ~2      ~1, 5
          5      > RETURN                                                   ~2
   57     6*     > 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/aqc5R
function name:  rewind
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'rewind'
          2        DO_ICALL                                                 
   68     3        ASSIGN_OBJ                                               '_index'
          4        OP_DATA                                                  0
   69     5      > RETURN                                                   null

End of function rewind

End of class CSVFileIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.59 ms | 1392 KiB | 15 Q