3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Foo() { for ($i = 11; $i < 12; $i++) { echo 'In Foo.......',"\n"; $string=(yield $i); if (isset($string)) { echo "foo displaying sent data: "; echo "$string\n"; } } echo 'Foo is closed.',"\n"; return; } $gen = foo(); foreach ($gen as $value) { echo "Back in \$gen ........\n"; echo "Fetched value is $value\n"; if ($value == 11) { echo "\$gen injecting ....\n"; $generator->send('Hello World'); } echo "\$gen done working!\n"; } unset($gen); if(!isset($gen)) echo "\$gen is history\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 18
filename:       /in/VGFTr
function name:  (null)
number of ops:  25
compiled vars:  !0 = $gen, !1 = $value, !2 = $generator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   15     3      > FE_RESET_R                                       $5      !0, ->18
          4    > > FE_FETCH_R                                               $5, !1, ->18
   16     5    >   ECHO                                                     'Back+in+%24gen+........%0A'
   17     6        ROPE_INIT                                     3  ~7      'Fetched+value+is+'
          7        ROPE_ADD                                      1  ~7      ~7, !1
          8        ROPE_END                                      2  ~6      ~7, '%0A'
          9        ECHO                                                     ~6
   18    10        IS_EQUAL                                                 !1, 11
         11      > JMPZ                                                     ~9, ->16
   19    12    >   ECHO                                                     '%24gen+injecting+....%0A'
   20    13        INIT_METHOD_CALL                                         !2, 'send'
         14        SEND_VAL_EX                                              'Hello+World'
         15        DO_FCALL                                      0          
   22    16    >   ECHO                                                     '%24gen+done+working%21%0A'
   15    17      > JMP                                                      ->4
         18    >   FE_FREE                                                  $5
   24    19        UNSET_CV                                                 !0
   25    20        ISSET_ISEMPTY_CV                                 ~11     !0
         21        BOOL_NOT                                         ~12     ~11
         22      > JMPZ                                                     ~12, ->24
         23    >   ECHO                                                     '%24gen+is+history%0A'
         24    > > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
Branch analysis from position: 3
Branch analysis from position: 13
filename:       /in/VGFTr
function name:  Foo
number of ops:  20
compiled vars:  !0 = $i, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, 11
          2      > JMP                                                      ->14
    4     3    >   ECHO                                                     'In+Foo.......'
          4        ECHO                                                     '%0A'
    5     5        YIELD                                            $3      !0
          6        ASSIGN                                                   !1, $3
    6     7        ISSET_ISEMPTY_CV                                         !1
          8      > JMPZ                                                     ~5, ->13
    7     9    >   ECHO                                                     'foo+displaying+sent+data%3A+'
    8    10        NOP                                                      
         11        FAST_CONCAT                                      ~6      !1, '%0A'
         12        ECHO                                                     ~6
    3    13    >   PRE_INC                                                  !0
         14    >   IS_SMALLER                                               !0, 12
         15      > JMPNZ                                                    ~8, ->3
   11    16    >   ECHO                                                     'Foo+is+closed.'
         17        ECHO                                                     '%0A'
   12    18      > GENERATOR_RETURN                                         
   13    19*     > GENERATOR_RETURN                                         

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.81 ms | 1403 KiB | 14 Q