3v4l.org

run code in 300+ PHP versions simultaneously
<?php $generator = (function (): iterable { yield 5; throw new \Exception(sprintf('%f', microtime(true))); })(); try { foreach ($generator as $val) {} } catch (\Throwable $e) { $reflection = new \ReflectionGenerator($generator); var_dump($reflection->getTrace()); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
Found catch point at position: 9
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iPCem
function name:  (null)
number of ops:  20
compiled vars:  !0 = $generator, !1 = $val, !2 = $e, !3 = $reflection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                          ~4      [0]
    6     1        INIT_DYNAMIC_CALL                                        ~4
          2        DO_FCALL                                      0  $5      
    3     3        ASSIGN                                                   !0, $5
    9     4      > FE_RESET_R                                       $7      !0, ->7
          5    > > FE_FETCH_R                                               $7, !1, ->7
          6    > > JMP                                                      ->5
          7    >   FE_FREE                                                  $7
          8      > JMP                                                      ->19
   10     9  E > > CATCH                                       last         'Throwable'
   11    10    >   NEW                                              $8      'ReflectionGenerator'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !3, $8
   12    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !3, 'getTrace'
         16        DO_FCALL                                      0  $11     
         17        SEND_VAR                                                 $11
         18        DO_ICALL                                                 
   13    19    > > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/iPCem
function name:  {closure}
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        YIELD                                                    5
    5     2        NEW                                              $1      'Exception'
          3        INIT_FCALL                                               'sprintf'
          4        SEND_VAL                                                 '%25f'
          5        INIT_FCALL                                               'microtime'
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10        SEND_VAR_NO_REF_EX                                       $3
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $1
    6    13*     > GENERATOR_RETURN                                         

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.49 ms | 1017 KiB | 16 Q