3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test{ const SOMETHING = 1; private static $someMap; private $level; private $levelStr; private function Test($level, $levelStr){ $this->level = $level; $this->levelStr = $levelStr; } public static function getSomething(){ $cName = 'SOMETHING'; $sName = 'something'; self::setMap($cName,$sName); return self::$someMap[constant('Test::'.$cName)]; } public static function setMap($cName,$sName){ if(!isset(self::$someMap[constant('Test::'.$cName)])) { self::$someMap['Test::'.$cName] = new Test('Test::'.$cName, $sName); } } } $lvl = Test::getSomething(); print_r($lvl);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LvOnU
function name:  (null)
number of ops:  7
compiled vars:  !0 = $lvl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_STATIC_METHOD_CALL                                  'Test', 'getSomething'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   29     3        INIT_FCALL                                               'print_r'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Class Test:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LvOnU
function name:  Test
number of ops:  7
compiled vars:  !0 = $level, !1 = $levelStr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ASSIGN_OBJ                                               'level'
          3        OP_DATA                                                  !0
   10     4        ASSIGN_OBJ                                               'levelStr'
          5        OP_DATA                                                  !1
   11     6      > RETURN                                                   null

End of function test

Function getsomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LvOnU
function name:  getSomething
number of ops:  14
compiled vars:  !0 = $cName, !1 = $sName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 'SOMETHING'
   15     1        ASSIGN                                                   !1, 'something'
   16     2        INIT_STATIC_METHOD_CALL                                  'setMap'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
   17     6        INIT_FCALL                                               'constant'
          7        CONCAT                                           ~6      'Test%3A%3A', !0
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
         10        FETCH_STATIC_PROP_R          unknown             ~5      'someMap'
         11        FETCH_DIM_R                                      ~8      ~5, $7
         12      > RETURN                                                   ~8
   18    13*     > RETURN                                                   null

End of function getsomething

Function setmap:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/LvOnU
function name:  setMap
number of ops:  20
compiled vars:  !0 = $cName, !1 = $sName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        INIT_FCALL                                               'constant'
          3        CONCAT                                           ~3      'Test%3A%3A', !0
          4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
          6        FETCH_STATIC_PROP_IS                             ~2      'someMap'
          7        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~2, $4
          8        BOOL_NOT                                         ~6      ~5
          9      > JMPZ                                                     ~6, ->19
   22    10    >   CONCAT                                           ~8      'Test%3A%3A', !0
         11        NEW                                              $10     'Test'
         12        CONCAT                                           ~11     'Test%3A%3A', !0
         13        SEND_VAL_EX                                              ~11
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        FETCH_STATIC_PROP_W          unknown             $7      'someMap'
         17        ASSIGN_DIM                                               $7, ~8
         18        OP_DATA                                                  $10
   24    19    > > RETURN                                                   null

End of function setmap

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.09 ms | 1392 KiB | 17 Q