3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myGeneratorFunction($foo) { // ... do some stuff with $foo ... $bar = yield from factoredComputation1($foo); // ... do some stuff with $bar ... $baz = yield from factoredComputation2($bar); return $baz; } function factoredComputation1($foo) { yield 1; yield 2; return 'zanzibar'; } function factoredComputation2($bar) { yield 3; yield 4; return 42; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rM9op
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E > > RETURN                                                   1

Function mygeneratorfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/rM9op
function name:  myGeneratorFunction
number of ops:  14
compiled vars:  !0 = $foo, !1 = $bar, !2 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    5     2        INIT_FCALL_BY_NAME                                       'factoredComputation1'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $3      
          5        YIELD_FROM                                       ~4      $3
          6        ASSIGN                                                   !1, ~4
    7     7        INIT_FCALL_BY_NAME                                       'factoredComputation2'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $6      
         10        YIELD_FROM                                       ~7      $6
         11        ASSIGN                                                   !2, ~7
    9    12      > GENERATOR_RETURN                                         
   10    13*     > GENERATOR_RETURN                                         

End of function mygeneratorfunction

Function factoredcomputation1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/rM9op
function name:  factoredComputation1
number of ops:  6
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   12     2        YIELD                                                    1
   13     3        YIELD                                                    2
   14     4      > GENERATOR_RETURN                                         
   15     5*     > GENERATOR_RETURN                                         

End of function factoredcomputation1

Function factoredcomputation2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/rM9op
function name:  factoredComputation2
number of ops:  6
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   17     2        YIELD                                                    3
   18     3        YIELD                                                    4
   19     4      > GENERATOR_RETURN                                         
   20     5*     > GENERATOR_RETURN                                         

End of function factoredcomputation2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.16 ms | 1399 KiB | 13 Q