3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $test = range(0, 10); foreach ($test as $int) { echo 'before' . PHP_EOL; yield $int; echo 'after' . PHP_EOL; } } $test = test(); echo $test->current() . PHP_EOL; $test->next(); echo $test->current() . PHP_EOL; $test->next(); $test->next(); $test->previous();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oErGX
function name:  (null)
number of ops:  20
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0  $3      
          5        CONCAT                                           ~4      $3, '%0A'
          6        ECHO                                                     ~4
   16     7        INIT_METHOD_CALL                                         !0, 'next'
          8        DO_FCALL                                      0          
   17     9        INIT_METHOD_CALL                                         !0, 'current'
         10        DO_FCALL                                      0  $6      
         11        CONCAT                                           ~7      $6, '%0A'
         12        ECHO                                                     ~7
   18    13        INIT_METHOD_CALL                                         !0, 'next'
         14        DO_FCALL                                      0          
   19    15        INIT_METHOD_CALL                                         !0, 'next'
         16        DO_FCALL                                      0          
   20    17        INIT_METHOD_CALL                                         !0, 'previous'
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 12
filename:       /in/oErGX
function name:  test
number of ops:  14
compiled vars:  !0 = $test, !1 = $int
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 10
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !0, $2
    6     6      > FE_RESET_R                                       $4      !0, ->12
          7    > > FE_FETCH_R                                               $4, !1, ->12
    7     8    >   ECHO                                                     'before%0A'
    8     9        YIELD                                                    !1
    9    10        ECHO                                                     'after%0A'
    6    11      > JMP                                                      ->7
         12    >   FE_FREE                                                  $4
   11    13      > GENERATOR_RETURN                                         

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.84 ms | 1390 KiB | 16 Q