3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { echo "as cuf\n"; call_user_func('omg'); } catch (\Exception $e) { echo $e->getTraceAsString(); } echo "\n\n"; try { omg(); } catch (\Exception $e) { echo "as func call\n"; echo $e->getTraceAsString(); } function omg() { bbq(); } function bbq() { throw new \Exception("testing"); } function getExceptionString(\Exception $ex) { $string = ''; while ($ex) { $string .= "Exception " . get_class($ex) . ': ' . $ex->getMessage()."\n"; foreach ($ex->getTrace() as $tracePart) { $line = false; $string .= var_export($tracePart, true); $string .= "\n"; if (isset($tracePart['file']) ) { $line .= $tracePart['file']." "; } if (isset($tracePart['line']) ) { $line .= $tracePart['line']." "; } if (isset($tracePart["class"])) { $line .= $tracePart["class"]; } if (isset($tracePart["type"])) { $line .= $tracePart["type"]; } if (isset($tracePart["function"])) { $line .= $tracePart["function"]; } if ($line === false) { $string .= "***\n"; } else { $string .= $line."\n"; } } $ex = $ex->getPrevious(); if ($ex) { $string .= "Previous "; } }; return $string; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 4
Branch analysis from position: 4
2 jumps found. (Code = 107) Position 1 = 5, Position 2 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Found catch point at position: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BgGKq
function name:  (null)
number of ops:  18
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'as+cuf%0A'
    6     1        INIT_USER_CALL                                0          'call_user_func', 'omg'
          2        DO_FCALL                                      0          
          3      > JMP                                                      ->8
    8     4  E > > CATCH                                       last         'Exception'
    9     5    >   INIT_METHOD_CALL                                         !0, 'getTraceAsString'
          6        DO_FCALL                                      0  $2      
          7        ECHO                                                     $2
   12     8    >   ECHO                                                     '%0A%0A'
   15     9        INIT_FCALL_BY_NAME                                       'omg'
         10        DO_FCALL                                      0          
         11      > JMP                                                      ->17
   17    12  E > > CATCH                                       last         'Exception'
   18    13    >   ECHO                                                     'as+func+call%0A'
   19    14        INIT_METHOD_CALL                                         !0, 'getTraceAsString'
         15        DO_FCALL                                      0  $4      
         16        ECHO                                                     $4
   79    17    > > RETURN                                                   1

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

End of function omg

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

End of function bbq

Function getexceptionstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 3
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 51
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 51
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 44
Branch analysis from position: 40
Branch analysis from position: 36
Branch analysis from position: 32
Branch analysis from position: 27
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 57
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 3
Branch analysis from position: 58
Branch analysis from position: 3
Branch analysis from position: 57
Branch analysis from position: 51
filename:       /in/BgGKq
function name:  getExceptionString
number of ops:  60
compiled vars:  !0 = $ex, !1 = $string, !2 = $tracePart, !3 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   37     1        ASSIGN                                                   !1, ''
   39     2      > JMP                                                      ->57
   40     3    >   GET_CLASS                                        ~5      !0
          4        CONCAT                                           ~6      'Exception+', ~5
          5        CONCAT                                           ~7      ~6, '%3A+'
          6        INIT_METHOD_CALL                                         !0, 'getMessage'
          7        DO_FCALL                                      0  $8      
          8        CONCAT                                           ~9      ~7, $8
          9        CONCAT                                           ~10     ~9, '%0A'
         10        ASSIGN_OP                                     8          !1, ~10
   42    11        INIT_METHOD_CALL                                         !0, 'getTrace'
         12        DO_FCALL                                      0  $12     
         13      > FE_RESET_R                                       $13     $12, ->51
         14    > > FE_FETCH_R                                               $13, !2, ->51
   44    15    >   ASSIGN                                                   !3, <false>
   46    16        INIT_FCALL                                               'var_export'
         17        SEND_VAR                                                 !2
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $15     
         20        ASSIGN_OP                                     8          !1, $15
   47    21        ASSIGN_OP                                     8          !1, '%0A'
   49    22        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'file'
         23      > JMPZ                                                     ~18, ->27
   50    24    >   FETCH_DIM_R                                      ~19     !2, 'file'
         25        CONCAT                                           ~20     ~19, '+'
         26        ASSIGN_OP                                     8          !3, ~20
   52    27    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'line'
         28      > JMPZ                                                     ~22, ->32
   53    29    >   FETCH_DIM_R                                      ~23     !2, 'line'
         30        CONCAT                                           ~24     ~23, '+'
         31        ASSIGN_OP                                     8          !3, ~24
   55    32    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'class'
         33      > JMPZ                                                     ~26, ->36
   56    34    >   FETCH_DIM_R                                      ~27     !2, 'class'
         35        ASSIGN_OP                                     8          !3, ~27
   58    36    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'type'
         37      > JMPZ                                                     ~29, ->40
   59    38    >   FETCH_DIM_R                                      ~30     !2, 'type'
         39        ASSIGN_OP                                     8          !3, ~30
   61    40    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'function'
         41      > JMPZ                                                     ~32, ->44
   62    42    >   FETCH_DIM_R                                      ~33     !2, 'function'
         43        ASSIGN_OP                                     8          !3, ~33
   65    44    >   TYPE_CHECK                                    4          !3
         45      > JMPZ                                                     ~35, ->48
   66    46    >   ASSIGN_OP                                     8          !1, '%2A%2A%2A%0A'
         47      > JMP                                                      ->50
   69    48    >   CONCAT                                           ~37     !3, '%0A'
         49        ASSIGN_OP                                     8          !1, ~37
   42    50    > > JMP                                                      ->14
         51    >   FE_FREE                                                  $13
   72    52        INIT_METHOD_CALL                                         !0, 'getPrevious'
         53        DO_FCALL                                      0  $39     
         54        ASSIGN                                                   !0, $39
   73    55      > JMPZ                                                     !0, ->57
   74    56    >   ASSIGN_OP                                     8          !1, 'Previous+'
   39    57    > > JMPNZ                                                    !0, ->3
   78    58    > > RETURN                                                   !1
   79    59*     > RETURN                                                   null

End of function getexceptionstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.02 ms | 1404 KiB | 15 Q