3v4l.org

run code in 300+ PHP versions simultaneously
<?php $generator = function() { $current = 0; while (true) { $current++;; yield $current; } }; function seek($generator, $offset, $count = 1) { return new LimitIterator(new IteratorIterator($generator()), $offset, $count); } $test = seek($generator, 10, 3); foreach($test as $current) { echo $current, "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/eRnaP
function name:  (null)
number of ops:  15
compiled vars:  !0 = $generator, !1 = $test, !2 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeRnaP%3A3%240'
          1        ASSIGN                                                   !0, ~3
   15     2        INIT_FCALL                                               'seek'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 10
          5        SEND_VAL                                                 3
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   16     8      > FE_RESET_R                                       $7      !1, ->13
          9    > > FE_FETCH_R                                               $7, !2, ->13
   17    10    >   ECHO                                                     !2
         11        ECHO                                                     '%0A'
   16    12      > JMP                                                      ->9
         13    >   FE_FREE                                                  $7
   18    14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeRnaP%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 3
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 3
Branch analysis from position: 6
Branch analysis from position: 3
filename:       /in/eRnaP
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        ASSIGN                                                   !0, 0
    5     2      > JMP                                                      ->5
    6     3    >   PRE_INC                                                  !0
    7     4        YIELD                                                    !0
    5     5    > > JMPNZ                                                    <true>, ->3
    9     6    > > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FeRnaP%3A3%240

Function seek:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eRnaP
function name:  seek
number of ops:  15
compiled vars:  !0 = $generator, !1 = $offset, !2 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      1
   12     3        NEW                                              $3      'LimitIterator'
          4        NEW                                              $4      'IteratorIterator'
          5        INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0  $5      
          7        SEND_VAR_NO_REF_EX                                       $5
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $4
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0          
         13      > RETURN                                                   $3
   13    14*     > RETURN                                                   null

End of function seek

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.82 ms | 1402 KiB | 14 Q