3v4l.org

run code in 300+ PHP versions simultaneously
<?php function yieldMe() : iterable { yield 1; yield 2; yield 3; } function someFunction(bool $toArray=true) : iterable { $found = yieldMe(); if($toArray){ return iterator_to_array($found); } yield from $found; } $result = someFunction(); foreach($result as $r){ echo $r."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/bnhga
function name:  (null)
number of ops:  10
compiled vars:  !0 = $result, !1 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'somefunction'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   24     3      > FE_RESET_R                                       $4      !0, ->8
          4    > > FE_FETCH_R                                               $4, !1, ->8
   25     5    >   CONCAT                                           ~5      !1, '%0A'
          6        ECHO                                                     ~5
   24     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $4
   26     9      > RETURN                                                   1

Function yieldme:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/bnhga
function name:  yieldMe
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        YIELD                                                    1
    6     2        YIELD                                                    2
    7     3        YIELD                                                    3
    8     4      > GENERATOR_RETURN                                         

End of function yieldme

Function somefunction:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/bnhga
function name:  someFunction
number of ops:  13
compiled vars:  !0 = $toArray, !1 = $found
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV_INIT                                        !0      <true>
          1        GENERATOR_CREATE                                         
   12     2        INIT_FCALL                                               'yieldme'
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !1, $2
   14     5      > JMPZ                                                     !0, ->10
   15     6    >   INIT_FCALL                                               'iterator_to_array'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9      > GENERATOR_RETURN                                         
   18    10    >   YIELD_FROM                                       ~5      !1
         11        FREE                                                     ~5
   19    12      > GENERATOR_RETURN                                         

End of function somefunction

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.49 ms | 1399 KiB | 17 Q