3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace DummyTest\Lib { class TObject { public function __construct() { } } class TComponent extends \DummyTest\Lib\TObject { public function __construct() { parent::__construct(); } } class TSingletonComponent extends \DummyTest\Lib\TComponent { public function __construct() { parent::__construct(); } } class TDatabase extends \DummyTest\Lib\TSingletonComponent { public function __construct() { parent::__construct(); } public static function Init() { $db = new \DummyTest\Lib\Database\TPDO(); } } } namespace DummyTest\Lib\Database { class TDatabase extends \DummyTest\Lib\TComponent { public function __construct() { parent::__construct(); } } class TPDO extends \DummyTest\Lib\Database\TDatabase { protected $pdo; public function __construct() { parent::__construct(); echo serialize(\DummyTest\SystemConfig::Get('xxx')); // Fails in PHP } } } namespace DummyTest { class SystemConfig { protected static $config = array(); public function Get($name) { echo get_called_class().PHP_EOL; if(isset(static::$config[$name])) { return static::$config[$name]; } return null; } public function Set($name, $value) { static::$config[$name] = $value; } } SystemConfig::Set('xxx', 'yyy'); \DummyTest\Lib\TDatabase::Init(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   INIT_STATIC_METHOD_CALL                                  'DummyTest%5CSystemConfig', 'Set'
          1        SEND_VAL                                                 'xxx'
          2        SEND_VAL                                                 'yyy'
          3        DO_FCALL                                      0          
   62     4        INIT_STATIC_METHOD_CALL                                  'DummyTest%5CLib%5CTDatabase', 'Init'
          5        DO_FCALL                                      0          
   63     6      > RETURN                                                   1

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

End of function __construct

End of class DummyTest\Lib\TObject.

Class DummyTest\Lib\TComponent:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   10     2      > RETURN                                                   null

End of function __construct

End of class DummyTest\Lib\TComponent.

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

End of function __construct

End of class DummyTest\Lib\TSingletonComponent.

Class DummyTest\Lib\TDatabase:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   20     2      > RETURN                                                   null

End of function __construct

Function init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  Init
number of ops:  4
compiled vars:  !0 = $db
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'DummyTest%5CLib%5CDatabase%5CTPDO'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3      > RETURN                                                   null

End of function init

End of class DummyTest\Lib\TDatabase.

Class DummyTest\Lib\Database\TDatabase:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   32     2      > RETURN                                                   null

End of function __construct

End of class DummyTest\Lib\Database\TDatabase.

Class DummyTest\Lib\Database\TPDO:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  __construct
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   39     2        INIT_NS_FCALL_BY_NAME                                    'DummyTest%5CLib%5CDatabase%5Cserialize'
          3        INIT_STATIC_METHOD_CALL                                  'DummyTest%5CSystemConfig', 'Get'
          4        SEND_VAL_EX                                              'xxx'
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR_NO_REF_EX                                       $1
          7        DO_FCALL                                      0  $2      
          8        ECHO                                                     $2
   40     9      > RETURN                                                   null

End of function __construct

End of class DummyTest\Lib\Database\TPDO.

Class DummyTest\SystemConfig:
Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  Get
number of ops:  14
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   RECV                                             !0      
   49     1        INIT_NS_FCALL_BY_NAME                                    'DummyTest%5Cget_called_class'
          2        DO_FCALL                                      0  $1      
          3        FETCH_CONSTANT                                   ~2      'DummyTest%5CPHP_EOL'
          4        CONCAT                                           ~3      $1, ~2
          5        ECHO                                                     ~3
   50     6        FETCH_STATIC_PROP_IS                             ~4      'config'
          7        ISSET_ISEMPTY_DIM_OBJ                         0          ~4, !0
          8      > JMPZ                                                     ~5, ->12
   51     9    >   FETCH_STATIC_PROP_R          unknown             ~6      'config'
         10        FETCH_DIM_R                                      ~7      ~6, !0
         11      > RETURN                                                   ~7
   53    12    > > RETURN                                                   null
   54    13*     > RETURN                                                   null

End of function get

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1r5Um
function name:  Set
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   57     2        FETCH_STATIC_PROP_W          global              $2      'config'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   58     5      > RETURN                                                   null

End of function set

End of class DummyTest\SystemConfig.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.99 ms | 1404 KiB | 17 Q