3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface IDBResult { } class ResultIterator implements Iterator { private $_rs; private $_index = 0; private $_onLoad; function __construct(IDBResult $rs, callable $callback = null) { $this->_rs = $rs; $this->_onLoad = $callback ?: function($rec) { return $rec; }; } public function current() { return call_user_func($this->_onLoad, $this->_rec); } public function key() { return $this->_index; } public function next() { $this->_index++; $this->_rec = $this->_rs->FetchAssoc(); } public function rewind() { $this->_index = 0; $this->_rs->Rewind(); } public function valid() { return !is_null($this->_rec); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoVBm
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'resultiterator'
   38     1      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FNoVBm%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoVBm
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $rec
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1      > RETURN                                                   !0
          2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FNoVBm%3A13%240

Class IDBResult: [no user functions]
Class ResultIterator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoVBm
function name:  __construct
number of ops:  10
compiled vars:  !0 = $rs, !1 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   12     2        ASSIGN_OBJ                                               '_rs'
          3        OP_DATA                                                  !0
   13     4        JMP_SET                                          ~4      !1, ->7
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FNoVBm%3A13%240'
          6        QM_ASSIGN                                        ~4      ~5
          7        ASSIGN_OBJ                                               '_onLoad'
          8        OP_DATA                                                  ~4
   14     9      > 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/NoVBm
function name:  current
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      '_onLoad'
          1        INIT_USER_CALL                                1          'call_user_func', ~0
          2        FETCH_OBJ_R                                      ~1      '_rec'
          3        SEND_USER                                                ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   18     6*     > 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/NoVBm
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      '_index'
          1      > RETURN                                                   ~0
   22     2*     > 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/NoVBm
function name:  next
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   PRE_INC_OBJ                                              '_index'
   26     1        FETCH_OBJ_R                                      ~2      '_rs'
          2        INIT_METHOD_CALL                                         ~2, 'FetchAssoc'
          3        DO_FCALL                                      0  $3      
          4        ASSIGN_OBJ                                               '_rec'
          5        OP_DATA                                                  $3
   27     6      > 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/NoVBm
function name:  rewind
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   ASSIGN_OBJ                                               '_index'
          1        OP_DATA                                                  0
   31     2        FETCH_OBJ_R                                      ~1      '_rs'
          3        INIT_METHOD_CALL                                         ~1, 'Rewind'
          4        DO_FCALL                                      0          
   32     5      > 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/NoVBm
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                      ~0      '_rec'
          1        TYPE_CHECK                                    2  ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   36     4*     > RETURN                                                   null

End of function valid

End of class ResultIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.21 ms | 1399 KiB | 13 Q