3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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
based on JZWtS
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/RUa8u
function name:  (null)
number of ops:  14
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   NOP                                                      
  17     1        INIT_FCALL                                               'error_reporting'
         2        SEND_VAL                                                 -1
         3        DO_ICALL                                                 
  19     4        INIT_STATIC_METHOD_CALL                                  'Config', 'set'
         5        SEND_VAL_EX                                              'xxx'
         6        SEND_VAL_EX                                              'yyy'
         7        DO_FCALL                                      0          
  20     8        INIT_STATIC_METHOD_CALL                                  'Config', 'get'
         9        SEND_VAL_EX                                              'xxx'
        10        DO_FCALL                                      0  $3      
        11        CONCAT                                           ~4      $3, '%0A'
        12        ECHO                                                     ~4
        13      > RETURN                                                   1

Class Config:
Function get:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/RUa8u
function name:  get
number of ops:  6
compiled vars:  !0 = $name
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   8     0  E >   RECV                                             !0      
   9     1        FETCH_CLASS                                 515  :1      
         2        FETCH_R                      static member       $2      'config'
         3        FETCH_DIM_R                                      $3      $2, !0
         4      > RETURN                                                   $3
  10     5*     > RETURN                                                   null

End of function get

Function set:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/RUa8u
function name:  set
number of ops:  7
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_CLASS                                 515  :2      
         3        FETCH_W                      static member       $3      'config'
         4        ASSIGN_DIM                                               $3, !0
         5        OP_DATA                                                  !1
  14     6      > RETURN                                                   null

End of function set

End of class Config.

Generated using Vulcan Logic Dumper, using php 7.2.0