3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test ($n){ foreach($n as $a) { yield $a; } }; $execute = test; foreach($execute([1,2,5]) as $n){ echo $n.PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/qrhsd
function name:  (null)
number of ops:  12
compiled vars:  !0 = $execute, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_CONSTANT                                   ~2      'test'
          1        ASSIGN                                                   !0, ~2
   10     2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_VAL_EX                                              <array>
          4        DO_FCALL                                      0  $4      
          5      > FE_RESET_R                                       $5      $4, ->10
          6    > > FE_FETCH_R                                               $5, !1, ->10
   11     7    >   CONCAT                                           ~6      !1, '%0A'
          8        ECHO                                                     ~6
   10     9      > JMP                                                      ->6
         10    >   FE_FREE                                                  $5
   12    11      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
filename:       /in/qrhsd
function name:  test
number of ops:  8
compiled vars:  !0 = $n, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    3     2      > FE_RESET_R                                       $2      !0, ->6
          3    > > FE_FETCH_R                                               $2, !1, ->6
    4     4    >   YIELD                                                    !1
    3     5      > JMP                                                      ->3
          6    >   FE_FREE                                                  $2
    6     7      > GENERATOR_RETURN                                         

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.07 ms | 1395 KiB | 13 Q