3v4l.org

run code in 300+ PHP versions simultaneously
<?php class First { private $text = ''; public function __construct() { try { static::init(); $this->text = 'Ok'; } catch (\Exception $e) { $this->text = $e->getMessage(); } $this->text = 'None'; } public function __toString() { return $this->text; } protected static function init() { throw new \LogicException("Not implemented"); } } class Second extends First { protected static function init() { throw new \RuntimeException("Bad method"); } } $text = new Second(); echo $text;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FikDJ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'first'
   22     1        DECLARE_CLASS                                            'second', 'first'
   26     2        NEW                                              $1      'Second'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   27     5        ECHO                                                     !0
          6      > RETURN                                                   1

Class First:
Function __construct:
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: 5
Branch analysis from position: 5
2 jumps found. (Code = 107) Position 1 = 6, Position 2 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FikDJ
function name:  __construct
number of ops:  13
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_STATIC_METHOD_CALL                                  'init'
          1        DO_FCALL                                      0          
    8     2        ASSIGN_OBJ                                               'text'
          3        OP_DATA                                                  'Ok'
          4      > JMP                                                      ->10
    9     5  E > > CATCH                                       last         'Exception'
   10     6    >   INIT_METHOD_CALL                                         !0, 'getMessage'
          7        DO_FCALL                                      0  $4      
          8        ASSIGN_OBJ                                               'text'
          9        OP_DATA                                                  $4
   12    10    >   ASSIGN_OBJ                                               'text'
         11        OP_DATA                                                  'None'
   13    12      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FikDJ
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~0      'text'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   17     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function __tostring

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

End of function init

End of class First.

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

End of function init

End of class Second.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.72 ms | 1399 KiB | 13 Q