3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = []; function getNumsOdd(array $nums, array &$result) { foreach($nums as $key => $num) { if ($num % 2) { $result[$key] = $num; yield $num; } } } foreach(getNumsOdd([1,3,4,5,6]) as $x); var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/hL3Yj
function name:  (null)
number of ops:  12
compiled vars:  !0 = $result, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'getnumsodd'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $3      
          4      > FE_RESET_R                                       $4      $3, ->7
          5    > > FE_FETCH_R                                               $4, !1, ->7
          6    > > JMP                                                      ->5
          7    >   FE_FREE                                                  $4
   15     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

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

End of function getnumsodd

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.35 ms | 1399 KiB | 16 Q