3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ThrowsError { public $name = 'unnamed'; public function __construct($name) { $this->name = $name; throw new \Exception("I blew up the constructor of '$name'\n"); } } $emptyVar = null; $obj = (object)array('number' => 1); try { $emptyVar = new ThrowsError('emptyVar'); } catch (\Exception $e) { print($e->getMessage()); } try { $obj = new ThrowsError('obj'); } catch (\Exception $e) { print($e->getMessage()); } try { $notPreviouslyDefined = new ThrowsError('notPreviouslyDefined'); } catch (\Exception $e) { print($e->getMessage()); } var_dump($emptyVar); var_dump($obj); var_dump($notPreviouslyDefined);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Found catch point at position: 17
Branch analysis from position: 17
2 jumps found. (Code = 107) Position 1 = 18, Position 2 = -2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Found catch point at position: 26
Branch analysis from position: 26
2 jumps found. (Code = 107) Position 1 = 27, Position 2 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EfkNG
function name:  (null)
number of ops:  40
compiled vars:  !0 = $emptyVar, !1 = $obj, !2 = $e, !3 = $notPreviouslyDefined
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, null
   12     1        CAST                                          8  ~5      <array>
          2        ASSIGN                                                   !1, ~5
   15     3        NEW                                              $7      'ThrowsError'
          4        SEND_VAL_EX                                              'emptyVar'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $7
          7      > JMP                                                      ->12
   16     8  E > > CATCH                                       last         'Exception'
   17     9    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         10        DO_FCALL                                      0  $10     
         11        ECHO                                                     $10
   20    12    >   NEW                                              $11     'ThrowsError'
         13        SEND_VAL_EX                                              'obj'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $11
         16      > JMP                                                      ->21
   21    17  E > > CATCH                                       last         'Exception'
   22    18    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         19        DO_FCALL                                      0  $14     
         20        ECHO                                                     $14
   25    21    >   NEW                                              $15     'ThrowsError'
         22        SEND_VAL_EX                                              'notPreviouslyDefined'
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !3, $15
         25      > JMP                                                      ->30
   26    26  E > > CATCH                                       last         'Exception'
   27    27    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         28        DO_FCALL                                      0  $18     
         29        ECHO                                                     $18
   30    30    >   INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
   31    33        INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                                 
   32    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !3
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Class ThrowsError:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/EfkNG
function name:  __construct
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
    7     3        NEW                                              $2      'Exception'
          4        ROPE_INIT                                     3  ~4      'I+blew+up+the+constructor+of+%27'
          5        ROPE_ADD                                      1  ~4      ~4, !0
          6        ROPE_END                                      2  ~3      ~4, '%27%0A'
          7        SEND_VAL_EX                                              ~3
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $2
    8    10*     > RETURN                                                   null

End of function __construct

End of class ThrowsError.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.62 ms | 941 KiB | 16 Q