3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClassA { private static $someVariable = 99; public static function setVariable($newValue) { self::$someVariable = $newValue; } public static function getVariable() { return self::$someVariable; } } ClassA::setVariable(42); echo "Static var is currently " . ClassA::getVariable() . "\n"; echo "Default val should be 99, found: "; $reflectionClass = new ReflectionClass('ClassA'); var_dump($reflectionClass->getDefaultProperties()); echo "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZduM4
function name:  (null)
number of ops:  20
compiled vars:  !0 = $reflectionClass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_STATIC_METHOD_CALL                                  'ClassA', 'setVariable'
          1        SEND_VAL                                                 42
          2        DO_FCALL                                      0          
   20     3        INIT_STATIC_METHOD_CALL                                  'ClassA', 'getVariable'
          4        DO_FCALL                                      0  $2      
          5        CONCAT                                           ~3      'Static+var+is+currently+', $2
          6        CONCAT                                           ~4      ~3, '%0A'
          7        ECHO                                                     ~4
   22     8        ECHO                                                     'Default+val+should+be+99%2C+found%3A+'
   24     9        NEW                                              $5      'ReflectionClass'
         10        SEND_VAL_EX                                              'ClassA'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !0, $5
   25    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !0, 'getDefaultProperties'
         15        DO_FCALL                                      0  $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                                 
   27    18        ECHO                                                     '%0A'
         19      > RETURN                                                   1

Class ClassA:
Function setvariable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZduM4
function name:  setVariable
number of ops:  4
compiled vars:  !0 = $newValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_STATIC_PROP                                       'someVariable'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function setvariable

Function getvariable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZduM4
function name:  getVariable
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'someVariable'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function getvariable

End of class ClassA.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.73 ms | 1396 KiB | 15 Q