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() { $onLoad = $this->_onLoad; return $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/DR3Er
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'
   39     1      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FDR3Er%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DR3Er
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%2FDR3Er%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/DR3Er
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%2FDR3Er%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/DR3Er
function name:  current
number of ops:  9
compiled vars:  !0 = $onLoad
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~1      '_onLoad'
          1        ASSIGN                                                   !0, ~1
   18     2        INIT_DYNAMIC_CALL                                        !0
          3        CHECK_FUNC_ARG                                           
          4        FETCH_OBJ_FUNC_ARG                               $3      '_rec'
          5        SEND_FUNC_ARG                                            $3
          6        DO_FCALL                                      0  $4      
          7      > RETURN                                                   $4
   19     8*     > 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/DR3Er
function name:  key
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_OBJ_R                                      ~0      '_index'
          1      > RETURN                                                   ~0
   23     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/DR3Er
function name:  next
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   PRE_INC_OBJ                                              '_index'
   27     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
   28     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/DR3Er
function name:  rewind
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ASSIGN_OBJ                                               '_index'
          1        OP_DATA                                                  0
   32     2        FETCH_OBJ_R                                      ~1      '_rs'
          3        INIT_METHOD_CALL                                         ~1, 'Rewind'
          4        DO_FCALL                                      0          
   33     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/DR3Er
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   FETCH_OBJ_R                                      ~0      '_rec'
          1        TYPE_CHECK                                    2  ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   37     4*     > RETURN                                                   null

End of function valid

End of class ResultIterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.96 ms | 1399 KiB | 13 Q