3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fib() { try{ $a = 1; $b = 1; while(true) { $c = $a + $b; $a = $b; $b = $c; yield $c; }} finally { echo 'closing' . PHP_EOL; } } foreach(fib() as $f) { if ($f > 7) { throw new RuntimeException('Kaboom!'); } echo $f . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/cgcoU
function name:  (null)
number of ops:  15
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'fib'
          1        DO_FCALL                                      0  $1      
          2      > FE_RESET_R                                       $2      $1, ->13
          3    > > FE_FETCH_R                                               $2, !0, ->13
   18     4    >   IS_SMALLER                                               7, !0
          5      > JMPZ                                                     ~3, ->10
   19     6    >   NEW                                              $4      'RuntimeException'
          7        SEND_VAL_EX                                              'Kaboom%21'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $4
   21    10    >   CONCAT                                           ~6      !0, '%0A'
         11        ECHO                                                     ~6
   17    12      > JMP                                                      ->3
         13    >   FE_FREE                                                  $2
   22    14      > RETURN                                                   1

Function fib:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
2 jumps found. (Code = 162) Position 1 = 12, Position 2 = 11
Branch analysis from position: 12
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/cgcoU
function name:  fib
number of ops:  15
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    4     1        ASSIGN                                                   !0, 1
    5     2        ASSIGN                                                   !1, 1
    6     3      > JMP                                                      ->9
    7     4    >   ADD                                              ~6      !0, !1
          5        ASSIGN                                                   !2, ~6
    8     6        ASSIGN                                                   !0, !1
    9     7        ASSIGN                                                   !1, !2
   11     8        YIELD                                                    !2
    6     9    > > JMPNZ                                                    <true>, ->4
   12    10    > > FAST_CALL                                                ->12
         11    > > JMP                                                      ->14
   13    12    >   ECHO                                                     'closing%0A'
         13      > FAST_RET                                                 
   15    14    > > GENERATOR_RETURN                                         

End of function fib

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.92 ms | 1394 KiB | 14 Q