3v4l.org

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

Function g:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/VC9J2
function name:  g
number of ops:  14
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        YIELD                                            $2      'a'
          2        ASSIGN                                                   !0, $2
    5     3        YIELD                                            $4      'b'
          4        ASSIGN                                                   !1, $4
    6     5        YIELD                                                    
    7     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'compact'
          8        SEND_VAL                                                 'a'
          9        SEND_VAL                                                 'b'
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                                 
    9    13      > GENERATOR_RETURN                                         

End of function g

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.51 ms | 1399 KiB | 18 Q