3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function a() { return new Exception(); } function b() { $ex = a(); throw new Exception('message', 1337, $ex); } $ex = a(); echo (string)$ex; echo PHP_EOL . PHP_EOL . PHP_EOL; try { b(); } catch (Exception $ex) { echo (string)$ex; }
based on SBA4g
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 14
Branch analysis from position: 14
Jump found. Position 1 = -2
Found catch point at position: 11
Branch analysis from position: 11
Jump found. Position 1 = 12, Position 2 = -2
Branch analysis from position: 12
Jump found. Position 1 = -2
filename:       /in/59F4S
function name:  (null)
number of ops:  15
compiled vars:  !0 = $ex
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
   7     1        NOP                                                      
  12     2        INIT_FCALL                                               'a'
         3        DO_FCALL                                      0  $1      
         4        ASSIGN                                                   !0, $1
  13     5        CAST                                          6  ~3      !0
         6        ECHO                                                     ~3
  15     7        ECHO                                                     '%0A%0A%0A'
  18     8        INIT_FCALL                                               'b'
         9        DO_FCALL                                      0          
        10      > JMP                                                      ->14
  19    11  E > > CATCH                                                    'Exception', !0
  20    12    >   CAST                                          6  ~5      !0
        13        ECHO                                                     ~5
        14    > > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/59F4S
function name:  a
number of ops:  4
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   NEW                                              $0      :-6
         1        DO_FCALL                                      0          
         2      > RETURN                                                   $0
   5     3*     > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/59F4S
function name:  b
number of ops:  10
compiled vars:  !0 = $ex
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   8     0  E >   INIT_FCALL                                               'a'
         1        DO_FCALL                                      0  $1      
         2        ASSIGN                                                   !0, $1
   9     3        NEW                                              $3      :-5
         4        SEND_VAL_EX                                              'message'
         5        SEND_VAL_EX                                              1337
         6        SEND_VAR_EX                                              !0
         7        DO_FCALL                                      0          
         8      > THROW                                         0          $3
  10     9*     > RETURN                                                   null

End of function b

Generated using Vulcan Logic Dumper, using php 7.1.0