3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = 'monkey'; printf("[%-15s]\n", $s); printf("[%-10s]\n", $s); die; abstract class T { static public $instanses; final private function __construct(){ } public static function getInstance() { if (!(static::$instanses instanceof static)) { static::$instanses = new static; } return static::$instanses; } } class A extends T { static public $instanses; } class B extends A { static public $instanses; } $t = A::getInstance(); var_dump($t); $t1 = B::getInstance(); var_dump($t1); new B(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/iN42E
function name:  (null)
number of ops:  26
compiled vars:  !0 = $s, !1 = $t, !2 = $t1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'monkey'
    3     1        INIT_FCALL                                               'printf'
          2        SEND_VAL                                                 '%5B%25-15s%5D%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    4     5        INIT_FCALL                                               'printf'
          6        SEND_VAL                                                 '%5B%25-10s%5D%0A'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
    6     9      > EXIT                                                     
   36    10*       INIT_STATIC_METHOD_CALL                                  'A', 'getInstance'
         11*       DO_FCALL                                      0  $6      
         12*       ASSIGN                                                   !1, $6
   37    13*       INIT_FCALL                                               'var_dump'
         14*       SEND_VAR                                                 !1
         15*       DO_ICALL                                                 
   39    16*       INIT_STATIC_METHOD_CALL                                  'B', 'getInstance'
         17*       DO_FCALL                                      0  $9      
         18*       ASSIGN                                                   !2, $9
   40    19*       INIT_FCALL                                               'var_dump'
         20*       SEND_VAR                                                 !2
         21*       DO_ICALL                                                 
   42    22*       NEW                                              $12     'B'
         23*       DO_FCALL                                      0          
         24*       FREE                                                     $12
   47    25*     > RETURN                                                   1

Class T:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iN42E
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/iN42E
function name:  getInstance
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instanses'
          1        INSTANCEOF                                       ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->8
   19     4    >   NEW                          static              $4      
          5        DO_FCALL                                      0          
          6        ASSIGN_STATIC_PROP                                       'instanses'
          7        OP_DATA                                                  $4
   22     8    >   FETCH_STATIC_PROP_R          unknown             ~6      'instanses'
          9      > RETURN                                                   ~6
   23    10*     > RETURN                                                   null

End of function getinstance

End of class T.

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iN42E
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/iN42E
function name:  getInstance
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instanses'
          1        INSTANCEOF                                       ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->8
   19     4    >   NEW                          static              $4      
          5        DO_FCALL                                      0          
          6        ASSIGN_STATIC_PROP                                       'instanses'
          7        OP_DATA                                                  $4
   22     8    >   FETCH_STATIC_PROP_R          unknown             ~6      'instanses'
          9      > RETURN                                                   ~6
   23    10*     > RETURN                                                   null

End of function getinstance

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iN42E
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/iN42E
function name:  getInstance
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instanses'
          1        INSTANCEOF                                       ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->8
   19     4    >   NEW                          static              $4      
          5        DO_FCALL                                      0          
          6        ASSIGN_STATIC_PROP                                       'instanses'
          7        OP_DATA                                                  $4
   22     8    >   FETCH_STATIC_PROP_R          unknown             ~6      'instanses'
          9      > RETURN                                                   ~6
   23    10*     > RETURN                                                   null

End of function getinstance

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.93 ms | 1408 KiB | 17 Q