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/LDdRc
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%2FLDdRc%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%2FLDdRc%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 9
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 9
Branch analysis from position: 13
Branch analysis from position: 9
Branch analysis from position: 14
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 14
filename:       /in/LDdRc
function name:  {closure}
number of ops:  16
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, ->14
          3    > > FE_FETCH_R                                               $3, !1, ->14
   11     4    >   INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                                 
   13     7        ASSIGN                                                   !2, 1
          8      > JMP                                                      ->11
   15     9    >   YIELD                                                    !2
   13    10        PRE_INC                                                  !2
         11    >   IS_SMALLER_OR_EQUAL                                      !2, 3
         12      > JMPNZ                                                    ~8, ->9
   10    13    > > JMP                                                      ->3
         14    >   FE_FREE                                                  $3
   18    15      > GENERATOR_RETURN                                         

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.67 ms | 1400 KiB | 15 Q