3v4l.org

run code in 300+ PHP versions simultaneously
<?php function three() { throw new RuntimeException('first exception'); } function two() { try { three(); } catch (Throwable $e) { throw new CustomException('custom', previous: $e); } } function one() { two(); } class CustomException extends Exception { public function getFullTrace() { return $this->getPrevious()?->getTrace() ?? $this->getTrace(); } } try { one(); } catch (CustomException $e) { var_dump($e->getFullTrace()); }
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: 3
Branch analysis from position: 3
2 jumps found. (Code = 107) Position 1 = 4, Position 2 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m7HIQ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'one'
          1        DO_FCALL                                      0          
          2      > JMP                                                      ->9
   30     3  E > > CATCH                                       last         'CustomException'
   31     4    >   INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'getFullTrace'
          6        DO_FCALL                                      0  $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
   32     9    > > RETURN                                                   1

Function three:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/m7HIQ
function name:  three
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $0      'RuntimeException'
          1        SEND_VAL_EX                                              'first+exception'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
    5     4*     > RETURN                                                   null

End of function three

Function two:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
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
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/m7HIQ
function name:  two
number of ops:  11
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'three'
          1        DO_FCALL                                      0          
          2      > JMP                                                      ->10
   10     3  E > > CATCH                                       last         'Throwable'
   11     4    >   NEW                                              $2      'CustomException'
          5        SEND_VAL_EX                                              'custom'
          6        SEND_VAR_EX                                              !0, 'previous'
          7        CHECK_UNDEF_ARGS                                         
          8        DO_FCALL                                      1          
          9      > THROW                                         0          $2
   13    10    > > RETURN                                                   null

End of function two

Function one:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m7HIQ
function name:  one
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'two'
          1        DO_FCALL                                      0          
   18     2      > RETURN                                                   null

End of function one

Class CustomException:
Function getfulltrace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m7HIQ
function name:  getFullTrace
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_METHOD_CALL                                         'getPrevious'
          1        DO_FCALL                                      0  $0      
          2        JMP_NULL                                         $1      $0
          3        INIT_METHOD_CALL                                         $0, 'getTrace'
          4        DO_FCALL                                      0  $1      
          5        COALESCE                                         ~2      $1
          6        INIT_METHOD_CALL                                         'getTrace'
          7        DO_FCALL                                      0  $3      
          8        QM_ASSIGN                                        ~2      $3
          9      > RETURN                                                   ~2
   25    10*     > RETURN                                                   null

End of function getfulltrace

End of class CustomException.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.43 ms | 1005 KiB | 17 Q