3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); // Would also need the same code for BaseError abstract class BaseException extends Exception { private static $codeReflection; private function setCode(string $code) { if (!isset(self::$codeReflection)) { self::$codeReflection = new ReflectionProperty(self::class, 'code'); self::$codeReflection->setAccessible(true); } self::$codeReflection->setValue($this, $code); } public function __construct(string $message, string $code, \Throwable $previous = null) { parent::__construct($message, 0, $previous); $this->setCode($code); } } class DivisionByZeroException extends BaseException {} $e = new DivisionByZeroException("Test", 'Test001'); var_dump($e->getMessage(), $e->getCode());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GS5S0
function name:  (null)
number of ops:  14
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $1      'DivisionByZeroException'
          1        SEND_VAL_EX                                              'Test'
          2        SEND_VAL_EX                                              'Test001'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   28     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'getMessage'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        INIT_METHOD_CALL                                         !0, 'getCode'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class BaseException:
Function setcode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/GS5S0
function name:  setCode
number of ops:  21
compiled vars:  !0 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ISSET_ISEMPTY_STATIC_PROP                        ~1      'codeReflection'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->14
   11     4    >   NEW                                              $4      'ReflectionProperty'
          5        SEND_VAL_EX                                              'BaseException'
          6        SEND_VAL_EX                                              'code'
          7        DO_FCALL                                      0          
          8        ASSIGN_STATIC_PROP                                       'codeReflection'
          9        OP_DATA                                                  $4
   12    10        FETCH_STATIC_PROP_R          unknown             ~6      'codeReflection'
         11        INIT_METHOD_CALL                                         ~6, 'setAccessible'
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0          
   15    14    >   FETCH_STATIC_PROP_R          unknown             ~8      'codeReflection'
         15        INIT_METHOD_CALL                                         ~8, 'setValue'
         16        FETCH_THIS                                       $9      
         17        SEND_VAR_EX                                              $9
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0          
   16    20      > RETURN                                                   null

End of function setcode

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GS5S0
function name:  __construct
number of ops:  12
compiled vars:  !0 = $message, !1 = $code, !2 = $previous
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
   20     3        INIT_STATIC_METHOD_CALL                                  
          4        SEND_VAR_EX                                              !0
          5        SEND_VAL_EX                                              0
          6        SEND_VAR_EX                                              !2
          7        DO_FCALL                                      0          
   21     8        INIT_METHOD_CALL                                         'setCode'
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0          
   22    11      > RETURN                                                   null

End of function __construct

End of class BaseException.

Class DivisionByZeroException:
Function setcode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/GS5S0
function name:  setCode
number of ops:  21
compiled vars:  !0 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ISSET_ISEMPTY_STATIC_PROP                        ~1      'codeReflection'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->14
   11     4    >   NEW                                              $4      'ReflectionProperty'
          5        SEND_VAL_EX                                              'BaseException'
          6        SEND_VAL_EX                                              'code'
          7        DO_FCALL                                      0          
          8        ASSIGN_STATIC_PROP                                       'codeReflection'
          9        OP_DATA                                                  $4
   12    10        FETCH_STATIC_PROP_R          unknown             ~6      'codeReflection'
         11        INIT_METHOD_CALL                                         ~6, 'setAccessible'
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0          
   15    14    >   FETCH_STATIC_PROP_R          unknown             ~8      'codeReflection'
         15        INIT_METHOD_CALL                                         ~8, 'setValue'
         16        FETCH_THIS                                       $9      
         17        SEND_VAR_EX                                              $9
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0          
   16    20      > RETURN                                                   null

End of function setcode

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GS5S0
function name:  __construct
number of ops:  12
compiled vars:  !0 = $message, !1 = $code, !2 = $previous
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
   20     3        INIT_STATIC_METHOD_CALL                                  
          4        SEND_VAR_EX                                              !0
          5        SEND_VAL_EX                                              0
          6        SEND_VAR_EX                                              !2
          7        DO_FCALL                                      0          
   21     8        INIT_METHOD_CALL                                         'setCode'
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0          
   22    11      > RETURN                                                   null

End of function __construct

End of class DivisionByZeroException.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.94 ms | 1409 KiB | 15 Q