3v4l.org

run code in 300+ PHP versions simultaneously
<?php function genId() { $i = 1; while (true) { yield ++ $i; } } $id = genId(); for ($x=0; $x < 5; $x++) { echo $id->next(); }
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 = 5
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 5
Branch analysis from position: 11
Branch analysis from position: 5
filename:       /in/RXB4i
function name:  (null)
number of ops:  12
compiled vars:  !0 = $id, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'genid'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   11     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->9
   12     5    >   INIT_METHOD_CALL                                         !0, 'next'
          6        DO_FCALL                                      0  $5      
          7        ECHO                                                     $5
   11     8        PRE_INC                                                  !1
          9    >   IS_SMALLER                                               !1, 5
         10      > JMPNZ                                                    ~7, ->5
   13    11    > > RETURN                                                   1

Function genid:
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/RXB4i
function name:  genId
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, 1
    4     2      > JMP                                                      ->5
    5     3    >   PRE_INC                                          ~2      !0
          4        YIELD                                                    ~2
    4     5    > > JMPNZ                                                    <true>, ->3
    7     6    > > GENERATOR_RETURN                                         

End of function genid

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.4 ms | 1398 KiB | 14 Q