3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getNumsOdd(array $nums) { foreach($nums as $key => $num) { if ($num % 2) { yield $key => $num; } } } while($num = getNumsOdd([1,3,4,5,6])) { echo $num.PHP_EOL; 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 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 1
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 1
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 7
filename:       /in/f5lfh
function name:  (null)
number of ops:  13
compiled vars:  !0 = $num, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > JMP                                                      ->7
   12     1    >   CONCAT                                           ~2      !0, '%0A'
          2        ECHO                                                     ~2
   13     3        PRE_INC                                          ~3      !1
          4        IS_SMALLER                                               10, ~3
          5      > JMPZ                                                     ~4, ->7
   14     6    > > JMP                                                      ->12
   11     7    >   INIT_FCALL                                               'getnumsodd'
          8        SEND_VAL                                                 <array>
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                           ~6      !0, $5
         11      > JMPNZ                                                    ~6, ->1
   20    12    > > 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/f5lfh
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, !2
    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:
148.48 ms | 1399 KiB | 14 Q