3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen($a) { $b = yield $a; yield $a + $b + 1; } function yf() { yield from gen(1); yield from gen(4); } $g = yf(); $g->current(); $g->throw(new Exception("Whoa there lassie"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dtG9U
function name:  (null)
number of ops:  12
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'yf'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   14     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0          
   15     5        INIT_METHOD_CALL                                         !0, 'throw'
          6        NEW                                              $4      'Exception'
          7        SEND_VAL_EX                                              'Whoa+there+lassie'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $4
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/dtG9U
function name:  gen
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2        YIELD                                            $2      !0
          3        ASSIGN                                                   !1, $2
    5     4        ADD                                              ~4      !0, !1
          5        ADD                                              ~5      ~4, 1
          6        YIELD                                                    ~5
    6     7      > GENERATOR_RETURN                                         

End of function gen

Function yf:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/dtG9U
function name:  yf
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
    9     1        INIT_FCALL                                               'gen'
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        YIELD_FROM                                       ~1      $0
          5        FREE                                                     ~1
   10     6        INIT_FCALL                                               'gen'
          7        SEND_VAL                                                 4
          8        DO_FCALL                                      0  $2      
          9        YIELD_FROM                                       ~3      $2
         10        FREE                                                     ~3
   11    11      > GENERATOR_RETURN                                         

End of function yf

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.33 ms | 1399 KiB | 16 Q