3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Only the static methods shall be called using the static call syntax class Config { protected static $config = array(); public function get($name) { return static::$config[$name]; } public function set($name, $value) { static::$config[$name] = $value; } } error_reporting(-1); Config::set("xxx", "yyy"); // Error - Config::set is not marked as static print(Config::get("xxx")."\n"); // Error - Config::get is not marked as static
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RUa8u
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
   19     3        INIT_STATIC_METHOD_CALL                                  'Config', 'set'
          4        SEND_VAL                                                 'xxx'
          5        SEND_VAL                                                 'yyy'
          6        DO_FCALL                                      0          
   20     7        INIT_STATIC_METHOD_CALL                                  'Config', 'get'
          8        SEND_VAL                                                 'xxx'
          9        DO_FCALL                                      0  $2      
         10        CONCAT                                           ~3      $2, '%0A'
         11        ECHO                                                     ~3
         12      > RETURN                                                   1

Class Config:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RUa8u
function name:  get
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_STATIC_PROP_R          unknown             ~1      'config'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function get

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RUa8u
function name:  set
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        FETCH_STATIC_PROP_W          global              $2      'config'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   14     5      > RETURN                                                   null

End of function set

End of class Config.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.95 ms | 1396 KiB | 15 Q