3v4l.org

run code in 300+ PHP versions simultaneously
<?php function yieldAnything(): Generator { try { yield 42; } finally { echo "finally in yieldSomething()\n"; } } function iteratorConsumer(): void { $iterator = yieldAnything(); $iterator->current(); // to trigger the yield throw new RuntimeException("any-exception-here-or-in-any-child-call-before-yieldAnything()-finally-is-triggered"); } function inner(): void { try { iteratorConsumer(); } catch (\Throwable) { echo "catch in inner()\n"; } finally { echo "finally in inner()\n"; } } function outer(): void { try { inner(); } catch (\Throwable) { echo "catch in outer()\n"; } finally { echo "finally in outer()\n"; } } function main(): void { try { outer(); } catch(\Throwable) { echo "catch in main()\n"; } finally { echo "finally in main()\n"; } } main();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0vRCm
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   INIT_FCALL                                               'main'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function yieldanything:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 162) Position 1 = 4, Position 2 = 3
Branch analysis from position: 4
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/0vRCm
function name:  yieldAnything
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    6     1        YIELD                                                    42
    7     2      > FAST_CALL                                                ->4
          3    > > JMP                                                      ->6
    8     4    >   ECHO                                                     'finally+in+yieldSomething%28%29%0A'
          5      > FAST_RET                                                 
   10     6    > > GENERATOR_RETURN                                         

End of function yieldanything

Function iteratorconsumer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/0vRCm
function name:  iteratorConsumer
number of ops:  10
compiled vars:  !0 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'yieldanything'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0          
   16     5        NEW                                              $4      'RuntimeException'
          6        SEND_VAL_EX                                              'any-exception-here-or-in-any-child-call-before-yieldAnything%28%29-finally-is-triggered'
          7        DO_FCALL                                      0          
          8      > THROW                                         0          $4
   17     9*     > RETURN                                                   null

End of function iteratorconsumer

Function inner:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 162) Position 1 = 7, Position 2 = 6
Branch analysis from position: 7
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 6
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: 3
Branch analysis from position: 3
2 jumps found. (Code = 107) Position 1 = 4, Position 2 = -2
Branch analysis from position: 4
2 jumps found. (Code = 162) Position 1 = 7, Position 2 = 6
Branch analysis from position: 7
Branch analysis from position: 6
filename:       /in/0vRCm
function name:  inner
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'iteratorconsumer'
          1        DO_FCALL                                      0          
          2      > JMP                                                      ->5
   23     3  E > > CATCH                                       last         'Throwable'
   24     4    >   ECHO                                                     'catch+in+inner%28%29%0A'
   25     5    > > FAST_CALL                                                ->7
          6    > > JMP                                                      ->9
   26     7    >   ECHO                                                     'finally+in+inner%28%29%0A'
          8      > FAST_RET                                                 
   28     9    > > RETURN                                                   null

End of function inner

Function outer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 162) Position 1 = 7, Position 2 = 6
Branch analysis from position: 7
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 6
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: 3
Branch analysis from position: 3
2 jumps found. (Code = 107) Position 1 = 4, Position 2 = -2
Branch analysis from position: 4
2 jumps found. (Code = 162) Position 1 = 7, Position 2 = 6
Branch analysis from position: 7
Branch analysis from position: 6
filename:       /in/0vRCm
function name:  outer
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_FCALL                                               'inner'
          1        DO_FCALL                                      0          
          2      > JMP                                                      ->5
   35     3  E > > CATCH                                       last         'Throwable'
   36     4    >   ECHO                                                     'catch+in+outer%28%29%0A'
   37     5    > > FAST_CALL                                                ->7
          6    > > JMP                                                      ->9
   38     7    >   ECHO                                                     'finally+in+outer%28%29%0A'
          8      > FAST_RET                                                 
   40     9    > > RETURN                                                   null

End of function outer

Function main:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 162) Position 1 = 7, Position 2 = 6
Branch analysis from position: 7
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 6
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: 3
Branch analysis from position: 3
2 jumps found. (Code = 107) Position 1 = 4, Position 2 = -2
Branch analysis from position: 4
2 jumps found. (Code = 162) Position 1 = 7, Position 2 = 6
Branch analysis from position: 7
Branch analysis from position: 6
filename:       /in/0vRCm
function name:  main
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   INIT_FCALL                                               'outer'
          1        DO_FCALL                                      0          
          2      > JMP                                                      ->5
   45     3  E > > CATCH                                       last         'Throwable'
   46     4    >   ECHO                                                     'catch+in+main%28%29%0A'
   47     5    > > FAST_CALL                                                ->7
          6    > > JMP                                                      ->9
   48     7    >   ECHO                                                     'finally+in+main%28%29%0A'
          8      > FAST_RET                                                 
   50     9    > > RETURN                                                   null

End of function main

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.31 ms | 1020 KiB | 18 Q