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; } } A::setA('AAAA'); class B { use A; public function __construct() { var_dump(static::$_a); } } A::setA('AAAA'); new B(); B::setA('BBBB'); new B(); echo A::getA(); echo B::getA();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tG3Ip
function name:  (null)
number of ops:  23
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_STATIC_METHOD_CALL                                  'A', 'setA'
          1        SEND_VAL                                                 'AAAA'
          2        DO_FCALL                                      0          
   19     3        DECLARE_CLASS                                            'b'
   29     4        INIT_STATIC_METHOD_CALL                                  'A', 'setA'
          5        SEND_VAL                                                 'AAAA'
          6        DO_FCALL                                      0          
   31     7        NEW                                              $2      'B'
          8        DO_FCALL                                      0          
          9        FREE                                                     $2
   33    10        INIT_STATIC_METHOD_CALL                                  'B', 'setA'
         11        SEND_VAL_EX                                              'BBBB'
         12        DO_FCALL                                      0          
   35    13        NEW                                              $5      'B'
         14        DO_FCALL                                      0          
         15        FREE                                                     $5
   37    16        INIT_STATIC_METHOD_CALL                                  'A', 'getA'
         17        DO_FCALL                                      0  $7      
         18        ECHO                                                     $7
   39    19        INIT_STATIC_METHOD_CALL                                  'B', 'getA'
         20        DO_FCALL                                      0  $8      
         21        ECHO                                                     $8
         22      > RETURN                                                   1

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

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.56 ms | 1400 KiB | 15 Q