3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen($a) { try { $b = yield $a; yield $a + $b + 1; } catch (Exception $e) { echo "Caught Exception: {$e->getMessage()}\n"; } } function yf() { yield from gen(1); yield from gen(4); } $g = yf(); $g->current(); $g->throw(new Exception("Whoa there lassie")); echo "Sup son!";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y4XCg
function name:  (null)
number of ops:  13
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'yf'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   18     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0          
   19     5        INIT_METHOD_CALL                                         !0, 'throw'
          6        NEW                                              $4      'Exception'
          7        SEND_VAL_EX                                              'Whoa+there+lassie'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $4
         10        DO_FCALL                                      0          
   20    11        ECHO                                                     'Sup+son%21'
         12      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 161) 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
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Y4XCg
function name:  gen
number of ops:  16
compiled vars:  !0 = $a, !1 = $b, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    5     2        YIELD                                            $3      !0
          3        ASSIGN                                                   !1, $3
    6     4        ADD                                              ~5      !0, !1
          5        ADD                                              ~6      ~5, 1
          6        YIELD                                                    ~6
          7      > JMP                                                      ->15
    7     8  E > > CATCH                                       last         'Exception'
    8     9    >   ROPE_INIT                                     3  ~10     'Caught+Exception%3A+'
         10        INIT_METHOD_CALL                                         !2, 'getMessage'
         11        DO_FCALL                                      0  $8      
         12        ROPE_ADD                                      1  ~10     ~10, $8
         13        ROPE_END                                      2  ~9      ~10, '%0A'
         14        ECHO                                                     ~9
   10    15    > > GENERATOR_RETURN                                         

End of function gen

Function yf:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Y4XCg
function name:  yf
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   GENERATOR_CREATE                                         
   13     1        INIT_FCALL                                               'gen'
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        YIELD_FROM                                       ~1      $0
          5        FREE                                                     ~1
   14     6        INIT_FCALL                                               'gen'
          7        SEND_VAL                                                 4
          8        DO_FCALL                                      0  $2      
          9        YIELD_FROM                                       ~3      $2
         10        FREE                                                     ~3
   15    11      > GENERATOR_RETURN                                         

End of function yf

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.45 ms | 1403 KiB | 16 Q