3v4l.org

run code in 300+ PHP versions simultaneously
<?php $matchesMatches = function ($matches) { //$m = 1; //yield $m; // could put as a `for` so it is more optimized, but for now, that is premature optimization foreach ($matches as $match) { // var_dump($match); // yeild $m; for ($i = 1; $i <= 3; $i++) { // Note that $i is preserved between yields. yield $i; } } }; $matches = [1,2, 3]; $matches = [1 => array('a', 'b'), 2 => array('c', 'd'), 3 => array('e', 'f')]; foreach ($matchesMatches($matches) as $m) { var_dump($m); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/LNrKG
function name:  (null)
number of ops:  15
compiled vars:  !0 = $matchesMatches, !1 = $matches, !2 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLNrKG%3A4%240'
    3     1        ASSIGN                                                   !0, ~3
   20     2        ASSIGN                                                   !1, <array>
   21     3        ASSIGN                                                   !1, <array>
   22     4        INIT_DYNAMIC_CALL                                        !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $7      
          7      > FE_RESET_R                                       $8      $7, ->13
          8    > > FE_FETCH_R                                               $8, !2, ->13
   23     9    >   INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   22    12      > JMP                                                      ->8
         13    >   FE_FREE                                                  $8
   24    14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLNrKG%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
Branch analysis from position: 6
Branch analysis from position: 11
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 11
filename:       /in/LNrKG
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $matches, !1 = $match, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   10     2      > FE_RESET_R                                       $3      !0, ->11
          3    > > FE_FETCH_R                                               $3, !1, ->11
   13     4    >   ASSIGN                                                   !2, 1
          5      > JMP                                                      ->8
   15     6    >   YIELD                                                    !2
   13     7        PRE_INC                                                  !2
          8    >   IS_SMALLER_OR_EQUAL                                      !2, 3
          9      > JMPNZ                                                    ~7, ->6
   10    10    > > JMP                                                      ->3
         11    >   FE_FREE                                                  $3
   18    12      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FLNrKG%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.91 ms | 1404 KiB | 15 Q