3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait A { protected static $_a; public static function setA($a) { static::$_a = $a; } public static function getA() { return static::$_a; } } class B { use A; public function __construct() { var_dump(static::$_a); } } A::setA('AAAA'); class C { use A; public function __construct() { var_dump(static::$_a); } } class D extends B {} new B; new C; new D; A::setA('CCCCC'); new C;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v2kEC
function name:  (null)
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'b'
   27     1        INIT_STATIC_METHOD_CALL                                  'A', 'setA'
          2        SEND_VAL                                                 'AAAA'
          3        DO_FCALL                                      0          
   29     4        DECLARE_CLASS                                            'c'
   39     5        DECLARE_CLASS                                            'd', 'b'
   41     6        NEW                                              $1      'B'
          7        DO_FCALL                                      0          
          8        FREE                                                     $1
   42     9        NEW                                              $3      'C'
         10        DO_FCALL                                      0          
         11        FREE                                                     $3
   43    12        NEW                                              $5      'D'
         13        DO_FCALL                                      0          
         14        FREE                                                     $5
   45    15        INIT_STATIC_METHOD_CALL                                  'A', 'setA'
         16        SEND_VAL                                                 'CCCCC'
         17        DO_FCALL                                      0          
   47    18        NEW                                              $8      'C'
         19        DO_FCALL                                      0          
         20        FREE                                                     $8
         21      > RETURN                                                   1

Class A:
Function seta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v2kEC
function name:  setA
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_STATIC_PROP                                       '_a'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function seta

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

End of function geta

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v2kEC
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_STATIC_PROP_R          global lock         ~0      '_a'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   24     4      > RETURN                                                   null

End of function __construct

End of class B.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v2kEC
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_STATIC_PROP_R          global lock         ~0      '_a'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   36     4      > RETURN                                                   null

End of function __construct

End of class C.

Class D: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.29 ms | 1392 KiB | 15 Q