3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Model { protected static $__columns = []; protected static $cache = []; public function test() { var_dump($modelName::$cache); $modelName = get_class($this); $modelName::$cache = $modelName::$__columns; var_dump($modelName::$cache); } } class A extends Model { protected static $__columns = ["aaa", "aa", "a"]; } class B extends Model { protected static $__columns = ["bbb", "bb", "b"]; } $a = new A(); $a->test(); $b = new B(); $b->test(); $a->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BHup4
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   26     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
   28     5        NEW                                              $6      'B'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
   29     8        INIT_METHOD_CALL                                         !1, 'test'
          9        DO_FCALL                                      0          
   31    10        INIT_METHOD_CALL                                         !0, 'test'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Class Model:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BHup4
function name:  test
number of ops:  19
compiled vars:  !0 = $modelName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_CLASS                                   0  $1      !0
          2        FETCH_STATIC_PROP_R          global lock         ~2      'cache'
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                                 
   10     5        FETCH_THIS                                       ~4      
          6        GET_CLASS                                        ~5      ~4
          7        ASSIGN                                                   !0, ~5
   11     8        FETCH_CLASS                                   0  $7      !0
          9        FETCH_CLASS                                   0  $9      !0
         10        FETCH_STATIC_PROP_R          unknown             ~10     '__columns'
         11        ASSIGN_STATIC_PROP                                       'cache', $7
         12        OP_DATA                                                  ~10
   12    13        INIT_FCALL                                               'var_dump'
         14        FETCH_CLASS                                   0  $11     !0
         15        FETCH_STATIC_PROP_R          unknown             ~12     'cache'
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                                 
   13    18      > RETURN                                                   null

End of function test

End of class Model.

Class A:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BHup4
function name:  test
number of ops:  19
compiled vars:  !0 = $modelName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_CLASS                                   0  $1      !0
          2        FETCH_STATIC_PROP_R          global lock         ~2      'cache'
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                                 
   10     5        FETCH_THIS                                       ~4      
          6        GET_CLASS                                        ~5      ~4
          7        ASSIGN                                                   !0, ~5
   11     8        FETCH_CLASS                                   0  $7      !0
          9        FETCH_CLASS                                   0  $9      !0
         10        FETCH_STATIC_PROP_R          unknown             ~10     '__columns'
         11        ASSIGN_STATIC_PROP                                       'cache', $7
         12        OP_DATA                                                  ~10
   12    13        INIT_FCALL                                               'var_dump'
         14        FETCH_CLASS                                   0  $11     !0
         15        FETCH_STATIC_PROP_R          unknown             ~12     'cache'
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                                 
   13    18      > RETURN                                                   null

End of function test

End of class A.

Class B:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BHup4
function name:  test
number of ops:  19
compiled vars:  !0 = $modelName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_CLASS                                   0  $1      !0
          2        FETCH_STATIC_PROP_R          global lock         ~2      'cache'
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                                 
   10     5        FETCH_THIS                                       ~4      
          6        GET_CLASS                                        ~5      ~4
          7        ASSIGN                                                   !0, ~5
   11     8        FETCH_CLASS                                   0  $7      !0
          9        FETCH_CLASS                                   0  $9      !0
         10        FETCH_STATIC_PROP_R          unknown             ~10     '__columns'
         11        ASSIGN_STATIC_PROP                                       'cache', $7
         12        OP_DATA                                                  ~10
   12    13        INIT_FCALL                                               'var_dump'
         14        FETCH_CLASS                                   0  $11     !0
         15        FETCH_STATIC_PROP_R          unknown             ~12     'cache'
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                                 
   13    18      > RETURN                                                   null

End of function test

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.72 ms | 1400 KiB | 15 Q