3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Pipe { var $stderr; } function generator_eval(Generator $gen) { foreach ($gen as $k => $v) {} } function words() { foreach (["foo", "bar", "baz"] as $word) { yield $word; } } function uppercase(Traversable $in, Generator $error) { foreach ($in as $word) { yield strtoupper($word); } } $stderr = function() { for (;;) { $error = (yield); echo "Error! $error\n"; } }; foreach (uppercase(words(), $stderr()) as $word) { echo "$word\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/DIYFS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $stderr, !1 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDIYFS%3A27%240'
          1        ASSIGN                                                   !0, ~2
   34     2        INIT_FCALL                                               'uppercase'
          3        INIT_FCALL                                               'words'
          4        DO_FCALL                                      0  $4      
          5        SEND_VAR                                                 $4
          6        INIT_DYNAMIC_CALL                                        !0
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR                                                 $5
          9        DO_FCALL                                      0  $6      
         10      > FE_RESET_R                                       $7      $6, ->16
         11    > > FE_FETCH_R                                               $7, !1, ->16
   35    12    >   NOP                                                      
         13        FAST_CONCAT                                      ~8      !1, '%0A'
         14        ECHO                                                     ~8
   34    15      > JMP                                                      ->11
         16    >   FE_FREE                                                  $7
   36    17      > RETURN                                                   1

Function generator_eval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/DIYFS
function name:  generator_eval
number of ops:  7
compiled vars:  !0 = $gen, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1      > FE_RESET_R                                       $3      !0, ->5
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->5
          3    >   ASSIGN                                                   !2, ~4
          4      > JMP                                                      ->2
          5    >   FE_FREE                                                  $3
   11     6      > RETURN                                                   null

End of function generator_eval

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

End of function words

Function uppercase:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 10
filename:       /in/DIYFS
function name:  uppercase
number of ops:  12
compiled vars:  !0 = $in, !1 = $error, !2 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        GENERATOR_CREATE                                         
   22     3      > FE_RESET_R                                       $3      !0, ->10
          4    > > FE_FETCH_R                                               $3, !2, ->10
   23     5    >   INIT_FCALL                                               'strtoupper'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $4      
          8        YIELD                                                    $4
   22     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $3
   25    11      > GENERATOR_RETURN                                         

End of function uppercase

Function %00%7Bclosure%7D%2Fin%2FDIYFS%3A27%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
Branch analysis from position: 2
filename:       /in/DIYFS
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   GENERATOR_CREATE                                         
   28     1      > JMP                                                      ->8
   29     2    >   YIELD                                            $1      
          3        ASSIGN                                                   !0, $1
   30     4        ROPE_INIT                                     3  ~4      'Error%21+'
          5        ROPE_ADD                                      1  ~4      ~4, !0
          6        ROPE_END                                      2  ~3      ~4, '%0A'
          7        ECHO                                                     ~3
          8    > > JMPNZ                                                    <true>, ->2
   32     9    > > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FDIYFS%3A27%240

Class Pipe: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.56 ms | 1407 KiB | 17 Q