3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { //类常量 const constValue = "constValue"; //类属性 public $property = "properties"; //静态属性 static public $staticProperty = "staticProperty"; //普通函数 public function func() { } //静态函数 static public function staticFunc() { } } $xxoo = new A; //访问实例的属性 print $xxoo->property; //访问实例的函数 print $xxoo->func(); //也可以借助实例来访问静态成员 print $xxoo->staticFunc(); //如果不借助实例,那就直接用类名加双冒号 print A::staticFunc(); print A::constValue; print A::$staticProperty;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iu6UK
function name:  (null)
number of ops:  18
compiled vars:  !0 = $xxoo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        FETCH_OBJ_R                                      ~4      !0, 'property'
          4        ECHO                                                     ~4
   31     5        INIT_METHOD_CALL                                         !0, 'func'
          6        DO_FCALL                                      0  $5      
          7        ECHO                                                     $5
   34     8        INIT_METHOD_CALL                                         !0, 'staticFunc'
          9        DO_FCALL                                      0  $6      
         10        ECHO                                                     $6
   37    11        INIT_STATIC_METHOD_CALL                                  'A', 'staticFunc'
         12        DO_FCALL                                      0  $7      
         13        ECHO                                                     $7
   38    14        ECHO                                                     'constValue'
   39    15        FETCH_STATIC_PROP_R          unknown             ~8      'staticProperty'
         16        ECHO                                                     ~8
         17      > RETURN                                                   1

Class A:
Function func:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iu6UK
function name:  func
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   null

End of function func

Function staticfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iu6UK
function name:  staticFunc
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E > > RETURN                                                   null

End of function staticfunc

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.98 ms | 1394 KiB | 13 Q