3v4l.org

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


preferences:
156.08 ms | 2437 KiB | 9 Q