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'; private function privateMethod() { } } 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); } } } $r = new \ReflectionClass('A'); $p = $r->getProperty('private'); $p->setAccessible(true); //$p->setAccessible(false); $c = new stdClass(); $p->setValue($c, 'b'); var_dump($p->getValue($c)); //$p = $r->getProperty('public'); //$p->setAccessible(false); //var_dump($p->getValue(true));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1gucm
function name:  (null)
number of ops:  25
compiled vars:  !0 = $r, !1 = $p, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   NEW                                              $3      'ReflectionClass'
          1        SEND_VAL_EX                                              'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   46     4        INIT_METHOD_CALL                                         !0, 'getProperty'
          5        SEND_VAL_EX                                              'private'
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !1, $6
   47     8        INIT_METHOD_CALL                                         !1, 'setAccessible'
          9        SEND_VAL_EX                                              <true>
         10        DO_FCALL                                      0          
   49    11        NEW                                              $9      'stdClass'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $9
   50    14        INIT_METHOD_CALL                                         !1, 'setValue'
         15        SEND_VAR_EX                                              !2
         16        SEND_VAL_EX                                              'b'
         17        DO_FCALL                                      0          
   51    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !1, 'getValue'
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0  $13     
         22        SEND_VAR                                                 $13
         23        DO_ICALL                                                 
   55    24      > RETURN                                                   1

Class Ex:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1gucm
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:
Function privatemethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1gucm
function name:  privateMethod
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   null

End of function privatemethod

End of class A.

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/1gucm
function name:  __construct
number of ops:  16
compiled vars:  !0 = $name, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   36     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > JMP                                                      ->15
   37     5  E > > CATCH                                       last         'Exception'
   38     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
   40    15    > > RETURN                                                   null

End of function __construct

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.82 ms | 1400 KiB | 15 Q