3v4l.org

run code in 300+ PHP versions simultaneously
<?php $generator = (function ($s) { yield from $s; })(['foo', 'bar']); echo $generator->current(); $generator->next(); $generator->next(); echo $generator->current(); $generator->rewind(); echo $generator->current();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iZlvU
function name:  (null)
number of ops:  21
compiled vars:  !0 = $generator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                          ~1      [0]
          1        INIT_DYNAMIC_CALL                                        ~1
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
    4     5        INIT_METHOD_CALL                                         !0, 'current'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
    5     8        INIT_METHOD_CALL                                         !0, 'next'
          9        DO_FCALL                                      0          
    6    10        INIT_METHOD_CALL                                         !0, 'next'
         11        DO_FCALL                                      0          
    7    12        INIT_METHOD_CALL                                         !0, 'current'
         13        DO_FCALL                                      0  $7      
         14        ECHO                                                     $7
    8    15        INIT_METHOD_CALL                                         !0, 'rewind'
         16        DO_FCALL                                      0          
    9    17        INIT_METHOD_CALL                                         !0, 'current'
         18        DO_FCALL                                      0  $9      
         19        ECHO                                                     $9
         20      > RETURN                                                   1


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

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.84 ms | 995 KiB | 13 Q