3v4l.org

run code in 300+ PHP versions simultaneously
<?php class It implements \IteratorAggregate { public function getIterator(): \Generator { yield 'foo'; Fiber::suspend(); var_dump("not executed"); } } function f() { var_dump(yield from new It()); } $iterable = f(); $fiber = new Fiber(function () use ($iterable) { var_dump($iterable->current()); $iterable->next(); var_dump("not executed"); }); $ref = $fiber; $fiber->start(); gc_collect_cycles(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yjhbg
function name:  (null)
number of ops:  16
compiled vars:  !0 = $iterable, !1 = $fiber, !2 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'it'
   17     1        INIT_FCALL                                               'f'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !0, $3
   19     4        NEW                                              $5      'Fiber'
          5        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          6        BIND_LEXICAL                                             ~6, !0
   23     7        SEND_VAL_EX                                              ~6
   19     8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $5
   25    10        ASSIGN                                                   !2, !1
   27    11        INIT_METHOD_CALL                                         !1, 'start'
         12        DO_FCALL                                      0          
   29    13        INIT_FCALL                                               'gc_collect_cycles'
         14        DO_ICALL                                                 
   31    15      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yjhbg
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $iterable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   BIND_STATIC                                              !0
   20     1        INIT_FCALL                                               'var_dump'
          2        INIT_METHOD_CALL                                         !0, 'current'
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR                                                 $1
          5        DO_ICALL                                                 
   21     6        INIT_METHOD_CALL                                         !0, 'next'
          7        DO_FCALL                                      0          
   22     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAL                                                 'not+executed'
         10        DO_ICALL                                                 
   23    11      > RETURN                                                   null

End of Dynamic Function 0

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Yjhbg
function name:  f
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   GENERATOR_CREATE                                         
   14     1        INIT_FCALL                                               'var_dump'
          2        NEW                                              $0      'It'
          3        DO_FCALL                                      0          
          4        YIELD_FROM                                       ~2      $0
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
   15     7      > GENERATOR_RETURN                                         

End of function f

Class It:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Yjhbg
function name:  getIterator
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GENERATOR_CREATE                                         
    7     1        YIELD                                                    'foo'
    8     2        INIT_STATIC_METHOD_CALL                                  'Fiber', 'suspend'
          3        DO_FCALL                                      0          
    9     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAL                                                 'not+executed'
          6        DO_ICALL                                                 
   10     7      > GENERATOR_RETURN                                         

End of function getiterator

End of class It.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.77 ms | 1018 KiB | 16 Q