3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { static $arr = []; public static function a() { self::$arr[] = 'Tx'; static::$arr[] = 'Ty'; } } T::a(); // make no sense if (TRUE) { class C { use T; public static function b() { self::$arr[] = 'Cx'; static::$arr[] = 'Cy'; } } class D { use T; public static function b() { self::$arr[] = 'Dx'; static::$arr[] = 'Dy'; } } } C::a(); C::b(); D::a(); D::b(); assert(C::$arr === ['Tx', 'Ty', 'Cx', 'Cy']); assert(D::$arr === ['Tx', 'Ty', 'Dx', 'Dy']); T::a(); // make no sense assert(C::$arr === ['Tx', 'Ty', 'Cx', 'Cy']); assert(D::$arr === ['Tx', 'Ty', 'Dx', 'Dy']);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/PUXoR
function name:  (null)
number of ops:  44
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  'T', 'a'
          1        DO_FCALL                                      0          
   15     2      > JMPZ                                                     <true>, ->5
   17     3    >   DECLARE_CLASS                                            'c'
   29     4        DECLARE_CLASS                                            'd'
   41     5    >   INIT_STATIC_METHOD_CALL                                  'C', 'a'
          6        DO_FCALL                                      0          
   42     7        INIT_STATIC_METHOD_CALL                                  'C', 'b'
          8        DO_FCALL                                      0          
   44     9        INIT_STATIC_METHOD_CALL                                  'D', 'a'
         10        DO_FCALL                                      0          
   45    11        INIT_STATIC_METHOD_CALL                                  'D', 'b'
         12        DO_FCALL                                      0          
   47    13        ASSERT_CHECK                                             
         14        INIT_FCALL                                               'assert'
         15        FETCH_STATIC_PROP_R          unknown             ~5      'arr'
         16        IS_IDENTICAL                                     ~6      ~5, <array>
         17        SEND_VAL                                                 ~6
         18        SEND_VAL                                                 'assert%28C%3A%3A%24arr+%3D%3D%3D+%5B%27Tx%27%2C+%27Ty%27%2C+%27Cx%27%2C+%27Cy%27%5D%29'
         19        DO_ICALL                                                 
   48    20        ASSERT_CHECK                                             
         21        INIT_FCALL                                               'assert'
         22        FETCH_STATIC_PROP_R          unknown             ~8      'arr'
         23        IS_IDENTICAL                                     ~9      ~8, <array>
         24        SEND_VAL                                                 ~9
         25        SEND_VAL                                                 'assert%28D%3A%3A%24arr+%3D%3D%3D+%5B%27Tx%27%2C+%27Ty%27%2C+%27Dx%27%2C+%27Dy%27%5D%29'
         26        DO_ICALL                                                 
   50    27        INIT_STATIC_METHOD_CALL                                  'T', 'a'
         28        DO_FCALL                                      0          
   51    29        ASSERT_CHECK                                             
         30        INIT_FCALL                                               'assert'
         31        FETCH_STATIC_PROP_R          unknown             ~12     'arr'
         32        IS_IDENTICAL                                     ~13     ~12, <array>
         33        SEND_VAL                                                 ~13
         34        SEND_VAL                                                 'assert%28C%3A%3A%24arr+%3D%3D%3D+%5B%27Tx%27%2C+%27Ty%27%2C+%27Cx%27%2C+%27Cy%27%5D%29'
         35        DO_ICALL                                                 
   52    36        ASSERT_CHECK                                             
         37        INIT_FCALL                                               'assert'
         38        FETCH_STATIC_PROP_R          unknown             ~15     'arr'
         39        IS_IDENTICAL                                     ~16     ~15, <array>
         40        SEND_VAL                                                 ~16
         41        SEND_VAL                                                 'assert%28D%3A%3A%24arr+%3D%3D%3D+%5B%27Tx%27%2C+%27Ty%27%2C+%27Dx%27%2C+%27Dy%27%5D%29'
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Class T:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PUXoR
function name:  a
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_STATIC_PROP_W          global              $0      'arr'
          1        ASSIGN_DIM                                               $0
          2        OP_DATA                                                  'Tx'
    9     3        FETCH_STATIC_PROP_W          unknown             $2      'arr'
          4        ASSIGN_DIM                                               $2
          5        OP_DATA                                                  'Ty'
   10     6      > RETURN                                                   null

End of function a

End of class T.

Class C:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PUXoR
function name:  b
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_STATIC_PROP_W          global              $0      'arr'
          1        ASSIGN_DIM                                               $0
          2        OP_DATA                                                  'Cx'
   24     3        FETCH_STATIC_PROP_W          unknown             $2      'arr'
          4        ASSIGN_DIM                                               $2
          5        OP_DATA                                                  'Cy'
   25     6      > RETURN                                                   null

End of function b

End of class C.

Class D:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PUXoR
function name:  b
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_STATIC_PROP_W          global              $0      'arr'
          1        ASSIGN_DIM                                               $0
          2        OP_DATA                                                  'Dx'
   36     3        FETCH_STATIC_PROP_W          unknown             $2      'arr'
          4        ASSIGN_DIM                                               $2
          5        OP_DATA                                                  'Dy'
   37     6      > RETURN                                                   null

End of function b

End of class D.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.12 ms | 1404 KiB | 15 Q