3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getNumsOdd(array $nums) { foreach($nums as $key => $num) { if ($num % 2) { yield $num; } } } $i = 0; $gen = getNumsOdd([1,3,4,5,6]); while($num = $gen) { var_dump($num); if (++$i == 10){ break; } } /*foreach(getNumsOdd([1,3,4,5,6]) as $key => $num) { echo $key . '=>' . $num.PHP_EOL; }*/
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 6
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 13
filename:       /in/1qCns
function name:  (null)
number of ops:  16
compiled vars:  !0 = $i, !1 = $gen, !2 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 0
   11     1        INIT_FCALL                                               'getnumsodd'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   12     5      > JMP                                                      ->13
   13     6    >   INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                                 
   14     9        PRE_INC                                          ~7      !0
         10        IS_EQUAL                                                 ~7, 10
         11      > JMPZ                                                     ~8, ->13
   15    12    > > JMP                                                      ->15
   12    13    >   ASSIGN                                           ~9      !2, !1
         14      > JMPNZ                                                    ~9, ->6
   21    15    > > RETURN                                                   1

Function getnumsodd:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
Branch analysis from position: 9
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 9
filename:       /in/1qCns
function name:  getNumsOdd
number of ops:  11
compiled vars:  !0 = $nums, !1 = $num, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2      > FE_RESET_R                                       $3      !0, ->9
          3    > > FE_FETCH_R                                       ~4      $3, !1, ->9
          4    >   ASSIGN                                                   !2, ~4
    5     5        MOD                                              ~6      !1, 2
          6      > JMPZ                                                     ~6, ->8
    6     7    >   YIELD                                                    !1
    4     8    > > JMP                                                      ->3
          9    >   FE_FREE                                                  $3
    9    10      > GENERATOR_RETURN                                         

End of function getnumsodd

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.57 ms | 1399 KiB | 16 Q