3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { yield 1; throw new Exception; yield 2; } $bar = foo(); try { $bar->next(); $bar->next(); } catch (Exception $e) { } var_dump($bar->current());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
filename:       /in/PTnDN
function name:  (null)
number of ops:  15
compiled vars:  !0 = $bar, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   11     3        INIT_METHOD_CALL                                         !0, 'next'
          4        DO_FCALL                                      0          
   12     5        INIT_METHOD_CALL                                         !0, 'next'
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->9
   13     8  E > > CATCH                                       last         'Exception'
   16     9    >   INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'current'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/PTnDN
function name:  foo
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        YIELD                                                    1
    4     2        NEW                                              $1      'Exception'
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $1
    5     5*       YIELD                                                    2
    6     6*     > GENERATOR_RETURN                                         

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.12 ms | 1398 KiB | 16 Q