3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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
Jump found. Position 1 = -2
filename:       /in/rM9op
function name:  (null)
number of ops:  4
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  11     1        NOP                                                      
  16     2        NOP                                                      
  20     3      > RETURN                                                   1

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

End of function mygeneratorfunction

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

End of function factoredcomputation1

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

End of function factoredcomputation2

Generated using Vulcan Logic Dumper, using php 7.3.0