3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait HasStatic { private static $x; public static function setX($x) { self::$x = $x; } public function useX() { return self::$x; } } HasStatic::setX(123); class UsesStatic { use HasStatic; } var_dump((new UsesStatic())->useX());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/428lo
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_STATIC_METHOD_CALL                                  'HasStatic', 'setX'
          1        SEND_VAL                                                 123
          2        DO_FCALL                                      0          
    8     3        DECLARE_CLASS                                            'usesstatic'
   11     4        INIT_FCALL                                               'var_dump'
          5        NEW                                              $1      'UsesStatic'
          6        DO_FCALL                                      0          
          7        INIT_METHOD_CALL                                         $1, 'useX'
          8        DO_FCALL                                      0  $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class HasStatic:
Function setx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/428lo
function name:  setX
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        ASSIGN_STATIC_PROP                                       'x'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function setx

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

End of function usex

End of class HasStatic.

Class UsesStatic: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.25 ms | 1395 KiB | 15 Q