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'"); } } $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()); } var_dump($emptyVar); var_dump($obj);
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 = 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 = 62) Position 1 = -2
filename:       /in/brsAf
function name:  (null)
number of ops:  28
compiled vars:  !0 = $emptyVar, !1 = $obj, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, null
   12     1        CAST                                          8  ~4      <array>
          2        ASSIGN                                                   !1, ~4
   15     3        NEW                                              $6      'ThrowsError'
          4        SEND_VAL_EX                                              'emptyVar'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $6
          7      > JMP                                                      ->12
   16     8  E > > CATCH                                       last         'Exception'
   17     9    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         10        DO_FCALL                                      0  $9      
         11        ECHO                                                     $9
   20    12    >   NEW                                              $10     'ThrowsError'
         13        SEND_VAL_EX                                              'obj'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $10
         16      > JMP                                                      ->21
   21    17  E > > CATCH                                       last         'Exception'
   22    18    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         19        DO_FCALL                                      0  $13     
         20        ECHO                                                     $13
   25    21    >   INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
   26    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Class ThrowsError:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/brsAf
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'
          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:
151.77 ms | 1400 KiB | 15 Q