3v4l.org

run code in 300+ PHP versions simultaneously
<?php class STon { private static $instance; protected static $item; public static function get() { if (static::$instance === null) { static::$instance = static::$item; } return static::$instance; } } class A extends STon { protected static $item = "A"; } class B extends STon { protected static $item = "B"; } var_dump(A::get(), A::get(), B::get(), B::get(), A::get(), A::get(), B::get(), B::get());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ErX59
function name:  (null)
number of ops:  27
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'A', 'get'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        INIT_STATIC_METHOD_CALL                                  'A', 'get'
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR                                                 $1
          7        INIT_STATIC_METHOD_CALL                                  'B', 'get'
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR                                                 $2
         10        INIT_STATIC_METHOD_CALL                                  'B', 'get'
         11        DO_FCALL                                      0  $3      
         12        SEND_VAR                                                 $3
         13        INIT_STATIC_METHOD_CALL                                  'A', 'get'
         14        DO_FCALL                                      0  $4      
         15        SEND_VAR                                                 $4
         16        INIT_STATIC_METHOD_CALL                                  'A', 'get'
         17        DO_FCALL                                      0  $5      
         18        SEND_VAR                                                 $5
         19        INIT_STATIC_METHOD_CALL                                  'B', 'get'
         20        DO_FCALL                                      0  $6      
         21        SEND_VAR                                                 $6
         22        INIT_STATIC_METHOD_CALL                                  'B', 'get'
         23        DO_FCALL                                      0  $7      
         24        SEND_VAR                                                 $7
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Class STon:
Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/ErX59
function name:  get
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instance'
          1        TYPE_CHECK                                    2          ~0
          2      > JMPZ                                                     ~1, ->6
   10     3    >   FETCH_STATIC_PROP_R          unknown             ~3      'item'
          4        ASSIGN_STATIC_PROP                                       'instance'
          5        OP_DATA                                                  ~3
   13     6    >   FETCH_STATIC_PROP_R          unknown             ~4      'instance'
          7      > RETURN                                                   ~4
   14     8*     > RETURN                                                   null

End of function get

End of class STon.

Class A:
Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/ErX59
function name:  get
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instance'
          1        TYPE_CHECK                                    2          ~0
          2      > JMPZ                                                     ~1, ->6
   10     3    >   FETCH_STATIC_PROP_R          unknown             ~3      'item'
          4        ASSIGN_STATIC_PROP                                       'instance'
          5        OP_DATA                                                  ~3
   13     6    >   FETCH_STATIC_PROP_R          unknown             ~4      'instance'
          7      > RETURN                                                   ~4
   14     8*     > RETURN                                                   null

End of function get

End of class A.

Class B:
Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/ErX59
function name:  get
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instance'
          1        TYPE_CHECK                                    2          ~0
          2      > JMPZ                                                     ~1, ->6
   10     3    >   FETCH_STATIC_PROP_R          unknown             ~3      'item'
          4        ASSIGN_STATIC_PROP                                       'instance'
          5        OP_DATA                                                  ~3
   13     6    >   FETCH_STATIC_PROP_R          unknown             ~4      'instance'
          7      > RETURN                                                   ~4
   14     8*     > RETURN                                                   null

End of function get

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.44 ms | 1405 KiB | 15 Q