3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace GeneratorExample; function uppercase(\Traversable $in) { foreach ($in as $word) { yield strtoupper($word); } } function reverse(\Traversable $in) { foreach ($in as $word) { yield strrev($word); } } function each_println(\Traversable $in) { foreach ($in as $line) { echo "$line\n"; } } $words = new \ArrayIterator(["foo", "bar", "baz"]); each_println(reverse(uppercase($words)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tasWf
function name:  (null)
number of ops:  14
compiled vars:  !0 = $words
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'ArrayIterator'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   28     4        INIT_NS_FCALL_BY_NAME                                    'GeneratorExample%5Ceach_println'
          5        INIT_NS_FCALL_BY_NAME                                    'GeneratorExample%5Creverse'
          6        INIT_NS_FCALL_BY_NAME                                    'GeneratorExample%5Cuppercase'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR_NO_REF_EX                                       $4
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR_NO_REF_EX                                       $5
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function generatorexample%5Cuppercase:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 9
filename:       /in/tasWf
function name:  GeneratorExample\uppercase
number of ops:  11
compiled vars:  !0 = $in, !1 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    7     2      > FE_RESET_R                                       $2      !0, ->9
          3    > > FE_FETCH_R                                               $2, !1, ->9
    8     4    >   INIT_NS_FCALL_BY_NAME                                    'GeneratorExample%5Cstrtoupper'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $3      
          7        YIELD                                                    $3
    7     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $2
   10    10      > GENERATOR_RETURN                                         

End of function generatorexample%5Cuppercase

Function generatorexample%5Creverse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 9
filename:       /in/tasWf
function name:  GeneratorExample\reverse
number of ops:  11
compiled vars:  !0 = $in, !1 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   14     2      > FE_RESET_R                                       $2      !0, ->9
          3    > > FE_FETCH_R                                               $2, !1, ->9
   15     4    >   INIT_NS_FCALL_BY_NAME                                    'GeneratorExample%5Cstrrev'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $3      
          7        YIELD                                                    $3
   14     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $2
   17    10      > GENERATOR_RETURN                                         

End of function generatorexample%5Creverse

Function generatorexample%5Ceach_println:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/tasWf
function name:  GeneratorExample\each_println
number of ops:  9
compiled vars:  !0 = $in, !1 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1      > FE_RESET_R                                       $2      !0, ->7
          2    > > FE_FETCH_R                                               $2, !1, ->7
   22     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~3      !1, '%0A'
          5        ECHO                                                     ~3
   21     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $2
   24     8      > RETURN                                                   null

End of function generatorexample%5Ceach_println

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.11 ms | 1394 KiB | 20 Q