3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { yield 1; yield 2; yield 3; } function wat($iter) { var_dump($iter->valid()); } function yf($iter) { yield from $iter; } // wat(gen1()); // wat([4, 5, 6]); $g = yf([4, 5, 6]); var_dump($g->current()); $g->send(10); var_dump($g->current());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L03di
function name:  (null)
number of ops:  18
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'yf'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   20     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'current'
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
   21     9        INIT_METHOD_CALL                                         !0, 'send'
         10        SEND_VAL_EX                                              10
         11        DO_FCALL                                      0          
   22    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'current'
         14        DO_FCALL                                      0  $6      
         15        SEND_VAR                                                 $6
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function gen1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/L03di
function name:  gen1
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
    5     2        YIELD                                                    2
    6     3        YIELD                                                    3
    7     4      > GENERATOR_RETURN                                         

End of function gen1

Function wat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L03di
function name:  wat
number of ops:  7
compiled vars:  !0 = $iter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'var_dump'
          2        INIT_METHOD_CALL                                         !0, 'valid'
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR                                                 $1
          5        DO_ICALL                                                 
   11     6      > RETURN                                                   null

End of function wat

Function yf:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/L03di
function name:  yf
number of ops:  5
compiled vars:  !0 = $iter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   14     2        YIELD_FROM                                       ~1      !0
          3        FREE                                                     ~1
   15     4      > GENERATOR_RETURN                                         

End of function yf

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.08 ms | 1402 KiB | 16 Q