3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bar(){ return yield from [0,1,2,3,4]; } $f = bar(); foreach($f as $x); var_dump($f->getReturn()); function baz(){ yield 1; yield 2; yield 3; yield 4; return yield 5; } $f = baz(); foreach($f as $x); var_dump($f->getReturn());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 6
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
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 6
filename:       /in/r9t4U
function name:  (null)
number of ops:  25
compiled vars:  !0 = $f, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'bar'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
    8     3      > FE_RESET_R                                       $4      !0, ->6
          4    > > FE_FETCH_R                                               $4, !1, ->6
          5    > > JMP                                                      ->4
          6    >   FE_FREE                                                  $4
    9     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'getReturn'
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
   20    12        INIT_FCALL                                               'baz'
         13        DO_FCALL                                      0  $7      
         14        ASSIGN                                                   !0, $7
   21    15      > FE_RESET_R                                       $9      !0, ->18
         16    > > FE_FETCH_R                                               $9, !1, ->18
         17    > > JMP                                                      ->16
         18    >   FE_FREE                                                  $9
   22    19        INIT_FCALL                                               'var_dump'
         20        INIT_METHOD_CALL                                         !0, 'getReturn'
         21        DO_FCALL                                      0  $10     
         22        SEND_VAR                                                 $10
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

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

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/r9t4U
function name:  baz
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   GENERATOR_CREATE                                         
   13     1        YIELD                                                    1
   14     2        YIELD                                                    2
   15     3        YIELD                                                    3
   16     4        YIELD                                                    4
   17     5        YIELD                                            $4      5
          6      > GENERATOR_RETURN                                         
   18     7*     > GENERATOR_RETURN                                         

End of function baz

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.94 ms | 1007 KiB | 16 Q