3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doStuff() { $last = 0; $current = 1; echo "out l, c: $last, $current\n"; yield 1; while ($current < 1000) { echo "start l, c: $last, $current\n"; $current = $last + $current; $last = $current - $last; echo "before l, c: $last, $current\n"; yield $current; echo "after l, c: $last, $current\n"; } } foreach(doStuff() as $num) $num; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/RZAC9
function name:  (null)
number of ops:  7
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'dostuff'
          1        DO_FCALL                                      0  $1      
          2      > FE_RESET_R                                       $2      $1, ->5
          3    > > FE_FETCH_R                                               $2, !0, ->5
          4    > > JMP                                                      ->3
          5    >   FE_FREE                                                  $2
   21     6      > RETURN                                                   1

Function dostuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 11
Branch analysis from position: 36
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 11
Branch analysis from position: 36
Branch analysis from position: 11
filename:       /in/RZAC9
function name:  doStuff
number of ops:  37
compiled vars:  !0 = $last, !1 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        ASSIGN                                                   !0, 0
    5     2        ASSIGN                                                   !1, 1
    6     3        ROPE_INIT                                     5  ~5      'out+l%2C+c%3A+'
          4        ROPE_ADD                                      1  ~5      ~5, !0
          5        ROPE_ADD                                      2  ~5      ~5, '%2C+'
          6        ROPE_ADD                                      3  ~5      ~5, !1
          7        ROPE_END                                      4  ~4      ~5, '%0A'
          8        ECHO                                                     ~4
    7     9        YIELD                                                    1
    8    10      > JMP                                                      ->34
    9    11    >   ROPE_INIT                                     5  ~10     'start+l%2C+c%3A+'
         12        ROPE_ADD                                      1  ~10     ~10, !0
         13        ROPE_ADD                                      2  ~10     ~10, '%2C+'
         14        ROPE_ADD                                      3  ~10     ~10, !1
         15        ROPE_END                                      4  ~9      ~10, '%0A'
         16        ECHO                                                     ~9
   10    17        ADD                                              ~13     !0, !1
         18        ASSIGN                                                   !1, ~13
   11    19        SUB                                              ~15     !1, !0
         20        ASSIGN                                                   !0, ~15
   13    21        ROPE_INIT                                     5  ~18     'before+l%2C+c%3A+'
         22        ROPE_ADD                                      1  ~18     ~18, !0
         23        ROPE_ADD                                      2  ~18     ~18, '%2C+'
         24        ROPE_ADD                                      3  ~18     ~18, !1
         25        ROPE_END                                      4  ~17     ~18, '%0A'
         26        ECHO                                                     ~17
   14    27        YIELD                                                    !1
   15    28        ROPE_INIT                                     5  ~23     'after+l%2C+c%3A+'
         29        ROPE_ADD                                      1  ~23     ~23, !0
         30        ROPE_ADD                                      2  ~23     ~23, '%2C+'
         31        ROPE_ADD                                      3  ~23     ~23, !1
         32        ROPE_END                                      4  ~22     ~23, '%0A'
         33        ECHO                                                     ~22
    8    34    >   IS_SMALLER                                               !1, 1000
         35      > JMPNZ                                                    ~26, ->11
   17    36    > > GENERATOR_RETURN                                         

End of function dostuff

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.42 ms | 1403 KiB | 14 Q