3v4l.org

run code in 300+ PHP versions simultaneously
<?php function toto(): \Generator { yield 0 => '1'; yield 0 => '2'; yield 1 => '3'; } var_dump(toto()); foreach (toto() as $k => $toto) { var_dump($k); var_dump($toto); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/H0lgR
function name:  (null)
number of ops:  19
compiled vars:  !0 = $toto, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'toto'
          2        DO_FCALL                                      0  $2      
          3        SEND_VAR                                                 $2
          4        DO_ICALL                                                 
   12     5        INIT_FCALL                                               'toto'
          6        DO_FCALL                                      0  $4      
          7      > FE_RESET_R                                       $5      $4, ->17
          8    > > FE_FETCH_R                                       ~6      $5, !0, ->17
          9    >   ASSIGN                                                   !1, ~6
   13    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   14    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
   12    16      > JMP                                                      ->8
         17    >   FE_FREE                                                  $5
   15    18      > RETURN                                                   1

Function toto:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/H0lgR
function name:  toto
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        YIELD                                                    '1', 0
    5     2        YIELD                                                    '2', 0
    6     3        YIELD                                                    '3', 1
    7     4      > GENERATOR_RETURN                                         

End of function toto

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.58 ms | 1398 KiB | 17 Q