3v4l.org

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

Function fib:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
Branch analysis from position: 4
filename:       /in/ZPKHK
function name:  fib
number of ops:  17
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, 1
    4     2        ASSIGN                                                   !1, 1
    5     3      > JMP                                                      ->15
    6     4    >   ADD                                              ~5      !0, !1
          5        ASSIGN                                                   !2, ~5
    7     6        ASSIGN                                                   !0, !1
    8     7        ASSIGN                                                   !1, !2
    9     8        IS_EQUAL                                                 !2, 7
          9      > JMPZ                                                     ~9, ->14
   10    10    >   NEW                                              $10     'RuntimeException'
         11        SEND_VAL_EX                                              'Kaboom%21'
         12        DO_FCALL                                      0          
         13      > THROW                                         0          $10
   12    14    >   YIELD                                                    !2
    5    15    > > JMPNZ                                                    <true>, ->4
   14    16    > > GENERATOR_RETURN                                         

End of function fib

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.36 ms | 1399 KiB | 14 Q