3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { yield 0; yield ['a','b','c'][1]; yield 2; yield 3; yield $element = array('tom','dick','sally','sue')[2]; } try { $o = gen(); foreach($o as $g) { echo $g, boolval($g),"\n"; } } catch (Exception $e) { echo "caught exception"; } finally { echo "Whatever, this line will always run"; }
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 = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 162) Position 1 = 16, Position 2 = 15
Branch analysis from position: 16
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Found catch point at position: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
2 jumps found. (Code = 162) Position 1 = 16, Position 2 = 15
Branch analysis from position: 16
Branch analysis from position: 15
filename:       /in/PN2Jc
function name:  (null)
number of ops:  19
compiled vars:  !0 = $o, !1 = $g, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $4      
          2        ASSIGN                                                   !0, $4
   13     3      > FE_RESET_R                                       $6      !0, ->10
          4    > > FE_FETCH_R                                               $6, !1, ->10
   14     5    >   ECHO                                                     !1
          6        BOOL                                             ~7      !1
          7        ECHO                                                     ~7
          8        ECHO                                                     '%0A'
   13     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $6
         11      > JMP                                                      ->14
   17    12  E > > CATCH                                       last         'Exception'
   18    13    >   ECHO                                                     'caught+exception'
   20    14    > > FAST_CALL                                                ->16
         15    > > JMP                                                      ->18
   21    16    >   ECHO                                                     'Whatever%2C+this+line+will+always+run'
         17      > FAST_RET                                                 
   22    18    > > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/PN2Jc
function name:  gen
number of ops:  10
compiled vars:  !0 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        YIELD                                                    0
    4     2        FETCH_DIM_R                                      ~2      <array>, 1
          3        YIELD                                                    ~2
    5     4        YIELD                                                    2
    6     5        YIELD                                                    3
    7     6        FETCH_DIM_R                                      ~6      <array>, 2
          7        ASSIGN                                           ~7      !0, ~6
          8        YIELD                                                    ~7
    9     9      > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.53 ms | 1403 KiB | 14 Q