3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @author tuadmin * @version 1.0.0 */ class combinator implements SeekableIterator { private $_n = 0;//float val public function next(){$this->_n++;} public function rewind(){$this->_n = 0;} public function current(){ return $this->_n;} public function key(){} public function valid(){return $this->_n < 10000000000000000000;} public function seek($pos){$this->_n = $pos;} } $comb = new combinator();$float = 10000000000; echo "-------------incorrect limit Iterator float seek----------\n"; foreach(new limitIterator($comb,$float,3) as $current){ echo $current."\n";} echo "-------------correct----------\n"; for($comb->seek($float) ; $comb->current() < $float+3 && $comb->valid();$comb->next()){ echo $comb->current()."\n";}
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 22
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 16
filename:       /in/mCQBW
function name:  (null)
number of ops:  38
compiled vars:  !0 = $comb, !1 = $float, !2 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'combinator'
   16     1        NEW                                              $3      'combinator'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
          4        ASSIGN                                                   !1, 10000000000
   17     5        ECHO                                                     '-------------incorrect+limit+Iterator+float+seek----------%0A'
   18     6        NEW                                              $7      'limitIterator'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        SEND_VAL_EX                                              3
         10        DO_FCALL                                      0          
         11      > FE_RESET_R                                       $9      $7, ->16
         12    > > FE_FETCH_R                                               $9, !2, ->16
         13    >   CONCAT                                           ~10     !2, '%0A'
         14        ECHO                                                     ~10
         15      > JMP                                                      ->12
         16    >   FE_FREE                                                  $9
   19    17        ECHO                                                     '-------------correct----------%0A'
   20    18        INIT_METHOD_CALL                                         !0, 'seek'
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0          
         21      > JMP                                                      ->28
         22    >   INIT_METHOD_CALL                                         !0, 'current'
         23        DO_FCALL                                      0  $12     
         24        CONCAT                                           ~13     $12, '%0A'
         25        ECHO                                                     ~13
         26        INIT_METHOD_CALL                                         !0, 'next'
         27        DO_FCALL                                      0          
         28    >   INIT_METHOD_CALL                                         !0, 'current'
         29        DO_FCALL                                      0  $15     
         30        ADD                                              ~16     !1, 3
         31        IS_SMALLER                                       ~17     $15, ~16
         32      > JMPZ_EX                                          ~17     ~17, ->36
         33    >   INIT_METHOD_CALL                                         !0, 'valid'
         34        DO_FCALL                                      0  $18     
         35        BOOL                                             ~17     $18
         36    > > JMPNZ                                                    ~17, ->22
         37    > > RETURN                                                   1

Class combinator:
Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mCQBW
function name:  next
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   PRE_INC_OBJ                                              '_n'
          1      > 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/mCQBW
function name:  rewind
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN_OBJ                                               '_n'
          1        OP_DATA                                                  0
          2      > 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/mCQBW
function name:  current
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      '_n'
          1      > RETURN                                                   ~0
          2*     > 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/mCQBW
function name:  key
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > 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/mCQBW
function name:  valid
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      '_n'
          1        IS_SMALLER                                       ~1      ~0, 1.0e+19
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function valid

Function seek:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mCQBW
function name:  seek
number of ops:  4
compiled vars:  !0 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               '_n'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function seek

End of class combinator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
132.46 ms | 1407 KiB | 13 Q