3v4l.org

run code in 300+ PHP versions simultaneously
<?php $generator = (function ($s) { yield from $s; })(['foo', 'bar']); echo $generator->current(); $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/4lPqO
function name:  (null)
number of ops:  19
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, 'current'
         11        DO_FCALL                                      0  $6      
         12        ECHO                                                     $6
    7    13        INIT_METHOD_CALL                                         !0, 'rewind'
         14        DO_FCALL                                      0          
    8    15        INIT_METHOD_CALL                                         !0, 'current'
         16        DO_FCALL                                      0  $8      
         17        ECHO                                                     $8
         18      > 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/4lPqO
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:
137.89 ms | 995 KiB | 13 Q