3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo($flag = false): \Generator { if ($flag) { return null; } yield from [1, 2]; } function bar($flag = false): \Generator { if ($flag) { return null; } return internal(); } function internal(): \Generator { yield from [1, 2]; } foreach (foo() as $v){} foreach (foo(true) as $v){} foreach (bar() as $v){} foreach (bar(true) as $v){}
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
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 18
Branch analysis from position: 12
Branch analysis from position: 5
filename:       /in/EpIjA
function name:  (null)
number of ops:  27
compiled vars:  !0 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                                   'foo'
          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
   27     6        INIT_FCALL                                                   'foo'
          7        SEND_VAL                                                     <true>
          8        DO_FCALL                                          0  $3      
          9      > FE_RESET_R                                           $4      $3, ->12
         10    > > FE_FETCH_R                                                   $4, !0, ->12
         11    > > JMP                                                          ->10
         12    >   FE_FREE                                                      $4
   28    13        INIT_FCALL                                                   'bar'
         14        DO_FCALL                                          0  $5      
         15      > FE_RESET_R                                           $6      $5, ->18
         16    > > FE_FETCH_R                                                   $6, !0, ->18
         17    > > JMP                                                          ->16
         18    >   FE_FREE                                                      $6
   29    19        INIT_FCALL                                                   'bar'
         20        SEND_VAL                                                     <true>
         21        DO_FCALL                                          0  $7      
         22      > FE_RESET_R                                           $8      $7, ->25
         23    > > FE_FETCH_R                                                   $8, !0, ->25
         24    > > JMP                                                          ->23
         25    >   FE_FREE                                                      $8
         26      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/EpIjA
function name:  foo
number of ops:  7
compiled vars:  !0 = $flag
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                            !0      <false>
          1        GENERATOR_CREATE                                             
    5     2      > JMPZ                                                         !0, ->4
    6     3    > > GENERATOR_RETURN                                             
    9     4    >   YIELD_FROM                                           ~1      <array>
          5        FREE                                                         ~1
   10     6      > GENERATOR_RETURN                                             

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EpIjA
function name:  bar
number of ops:  10
compiled vars:  !0 = $flag
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV_INIT                                            !0      <false>
   14     1      > JMPZ                                                         !0, ->4
   15     2    >   VERIFY_RETURN_TYPE                                   ~1      null
          3      > RETURN                                                       ~1
   18     4    >   INIT_FCALL_BY_NAME                                           'internal'
          5        DO_FCALL                                          0  $2      
          6        VERIFY_RETURN_TYPE                                           $2
          7      > RETURN                                                       $2
   19     8*       VERIFY_RETURN_TYPE                                           
          9*     > RETURN                                                       null

End of function bar

Function internal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/EpIjA
function name:  internal
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   GENERATOR_CREATE                                             
   23     1        YIELD_FROM                                           ~0      <array>
          2        FREE                                                         ~0
   24     3      > GENERATOR_RETURN                                             

End of function internal

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.15 ms | 1474 KiB | 12 Q