3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mkGenerator(){ for($i = 0; $i <= 10; $i++) { echo "[$i]"; yield $i; } } function mkGenerator2(){ for($i = 10; $i <= 25; $i++) { echo "($i)"; yield $i; } } $generator1 = mkGenerator(); $generator2 = mkGenerator2(); $multiIterator = new \MultipleIterator(); $multiIterator->attachIterator($generator1); $multiIterator->attachIterator($generator2); foreach( $multiIterator as $data ) { var_export($data); echo ".\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/pUHUR
function name:  (null)
number of ops:  24
compiled vars:  !0 = $generator1, !1 = $generator2, !2 = $multiIterator, !3 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'mkgenerator'
          1        DO_FCALL                                      0  $4      
          2        ASSIGN                                                   !0, $4
   18     3        INIT_FCALL                                               'mkgenerator2'
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !1, $6
   20     6        NEW                                              $8      'MultipleIterator'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $8
   21     9        INIT_METHOD_CALL                                         !2, 'attachIterator'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
   22    12        INIT_METHOD_CALL                                         !2, 'attachIterator'
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0          
   24    15      > FE_RESET_R                                       $13     !2, ->22
         16    > > FE_FETCH_R                                               $13, !3, ->22
   25    17    >   INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                                 
   26    20        ECHO                                                     '.%0A'
   24    21      > JMP                                                      ->16
         22    >   FE_FREE                                                  $13
   27    23      > RETURN                                                   1

Function mkgenerator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
filename:       /in/pUHUR
function name:  mkGenerator
number of ops:  12
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        ASSIGN                                                   !0, 0
          2      > JMP                                                      ->9
    5     3    >   ROPE_INIT                                     3  ~3      '%5B'
          4        ROPE_ADD                                      1  ~3      ~3, !0
          5        ROPE_END                                      2  ~2      ~3, '%5D'
          6        ECHO                                                     ~2
    6     7        YIELD                                                    !0
    4     8        PRE_INC                                                  !0
          9    >   IS_SMALLER_OR_EQUAL                                      !0, 10
         10      > JMPNZ                                                    ~7, ->3
    8    11    > > GENERATOR_RETURN                                         

End of function mkgenerator

Function mkgenerator2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
filename:       /in/pUHUR
function name:  mkGenerator2
number of ops:  12
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   GENERATOR_CREATE                                         
   11     1        ASSIGN                                                   !0, 10
          2      > JMP                                                      ->9
   12     3    >   ROPE_INIT                                     3  ~3      '%28'
          4        ROPE_ADD                                      1  ~3      ~3, !0
          5        ROPE_END                                      2  ~2      ~3, '%29'
          6        ECHO                                                     ~2
   13     7        YIELD                                                    !0
   11     8        PRE_INC                                                  !0
          9    >   IS_SMALLER_OR_EQUAL                                      !0, 25
         10      > JMPNZ                                                    ~7, ->3
   15    11    > > GENERATOR_RETURN                                         

End of function mkgenerator2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.46 ms | 1403 KiB | 17 Q