3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ex extends \ReflectionException { public $reflector; public function __construct($reflector, $message = '', \Exception $previous = null) { parent::__construct($message, 0, $previous); $this->reflector = $reflector; } } class A { private $private = 'private'; public $public = 'public'; } class B { //public $private = 'pr'; private $public = 'pu'; } class C extends \ReflectionClass { public function __construct($name) { try { parent::__construct($name); } catch (\Exception $e) { throw new Ex($this, $e->getMessage(), $e); } } } try { $c = new C('bla'); } catch (Ex $e) { var_dump($e->reflector); } die(); $r = new \ReflectionClass('A'); $p = $r->getProperty('private'); $p->setAccessible(true); $p->setAccessible(false); var_dump($p->getValue(new stdClass())); $p = $r->getProperty('public'); $p->setAccessible(false); var_dump($p->getValue(new A()));
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 = 79) 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 = 79) Position 1 = -2
filename:       /in/6e7RJ
function name:  (null)
number of ops:  49
compiled vars:  !0 = $c, !1 = $e, !2 = $r, !3 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   NEW                                              $4      'C'
          1        SEND_VAL_EX                                              'bla'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
          4      > JMP                                                      ->10
   41     5  E > > CATCH                                       last         'Ex'
   42     6    >   INIT_FCALL                                               'var_dump'
          7        FETCH_OBJ_R                                      ~7      !1, 'reflector'
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                                 
   45    10    > > EXIT                                                     
   47    11*       NEW                                              $9      'ReflectionClass'
         12*       SEND_VAL_EX                                              'A'
         13*       DO_FCALL                                      0          
         14*       ASSIGN                                                   !2, $9
   48    15*       INIT_METHOD_CALL                                         !2, 'getProperty'
         16*       SEND_VAL_EX                                              'private'
         17*       DO_FCALL                                      0  $12     
         18*       ASSIGN                                                   !3, $12
   49    19*       INIT_METHOD_CALL                                         !3, 'setAccessible'
         20*       SEND_VAL_EX                                              <true>
         21*       DO_FCALL                                      0          
   50    22*       INIT_METHOD_CALL                                         !3, 'setAccessible'
         23*       SEND_VAL_EX                                              <false>
         24*       DO_FCALL                                      0          
   51    25*       INIT_FCALL                                               'var_dump'
         26*       INIT_METHOD_CALL                                         !3, 'getValue'
         27*       NEW                                              $16     'stdClass'
         28*       DO_FCALL                                      0          
         29*       SEND_VAR_NO_REF_EX                                       $16
         30*       DO_FCALL                                      0  $18     
         31*       SEND_VAR                                                 $18
         32*       DO_ICALL                                                 
   53    33*       INIT_METHOD_CALL                                         !2, 'getProperty'
         34*       SEND_VAL_EX                                              'public'
         35*       DO_FCALL                                      0  $20     
         36*       ASSIGN                                                   !3, $20
   54    37*       INIT_METHOD_CALL                                         !3, 'setAccessible'
         38*       SEND_VAL_EX                                              <false>
         39*       DO_FCALL                                      0          
   55    40*       INIT_FCALL                                               'var_dump'
         41*       INIT_METHOD_CALL                                         !3, 'getValue'
         42*       NEW                                              $23     'A'
         43*       DO_FCALL                                      0          
         44*       SEND_VAR_NO_REF_EX                                       $23
         45*       DO_FCALL                                      0  $25     
         46*       SEND_VAR                                                 $25
         47*       DO_ICALL                                                 
         48*     > RETURN                                                   1

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

End of function __construct

End of class Ex.

Class A: [no user functions]
Class B: [no user functions]
Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
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 = 108) Position 1 = -2
filename:       /in/6e7RJ
function name:  __construct
number of ops:  16
compiled vars:  !0 = $name, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
   32     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > JMP                                                      ->15
   33     5  E > > CATCH                                       last         'Exception'
   34     6    >   NEW                                              $3      'Ex'
          7        FETCH_THIS                                       $4      
          8        SEND_VAR_EX                                              $4
          9        INIT_METHOD_CALL                                         !1, 'getMessage'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR_NO_REF_EX                                       $5
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $3
   36    15    > > RETURN                                                   null

End of function __construct

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.77 ms | 1400 KiB | 15 Q