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'; if(! isset(self::$someMap[constant('Test::'.$cName)] )) { print "setting it"; self::$someMap['Test::'.$cName] = new Test('Test::'.$cName, $sName); } return self::$someMap[constant('Test::'.$cName)]; } public static function setMap($cName,$sName){ if(!isset(self::$someMap[constant('Test::'.$cName)])) { print "setting it"; self::$someMap['Test::'.$cName] = new Test('Test::'.$cName, $sName); } return self::$someMap; } } $lvl = Test::getSomething(); print_r($lvl);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W3eoi
function name:  (null)
number of ops:  7
compiled vars:  !0 = $lvl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_STATIC_METHOD_CALL                                  'Test', 'getSomething'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   34     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/W3eoi
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
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/W3eoi
function name:  getSomething
number of ops:  28
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_FCALL                                               'constant'
          3        CONCAT                                           ~5      'Test%3A%3A', !0
          4        SEND_VAL                                                 ~5
          5        DO_ICALL                                         $6      
          6        FETCH_STATIC_PROP_IS                             ~4      'someMap'
          7        ISSET_ISEMPTY_DIM_OBJ                         0  ~7      ~4, $6
          8        BOOL_NOT                                         ~8      ~7
          9      > JMPZ                                                     ~8, ->20
   17    10    >   ECHO                                                     'setting+it'
   18    11        CONCAT                                           ~10     'Test%3A%3A', !0
         12        NEW                                              $12     'Test'
         13        CONCAT                                           ~13     'Test%3A%3A', !0
         14        SEND_VAL_EX                                              ~13
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
         17        FETCH_STATIC_PROP_W          unknown             $9      'someMap'
         18        ASSIGN_DIM                                               $9, ~10
         19        OP_DATA                                                  $12
   20    20    >   INIT_FCALL                                               'constant'
         21        CONCAT                                           ~16     'Test%3A%3A', !0
         22        SEND_VAL                                                 ~16
         23        DO_ICALL                                         $17     
         24        FETCH_STATIC_PROP_R          unknown             ~15     'someMap'
         25        FETCH_DIM_R                                      ~18     ~15, $17
         26      > RETURN                                                   ~18
   21    27*     > 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 = 20
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/W3eoi
function name:  setMap
number of ops:  23
compiled vars:  !0 = $cName, !1 = $sName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     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, ->20
   25    10    >   ECHO                                                     'setting+it'
   26    11        CONCAT                                           ~8      'Test%3A%3A', !0
         12        NEW                                              $10     'Test'
         13        CONCAT                                           ~11     'Test%3A%3A', !0
         14        SEND_VAL_EX                                              ~11
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
         17        FETCH_STATIC_PROP_W          unknown             $7      'someMap'
         18        ASSIGN_DIM                                               $7, ~8
         19        OP_DATA                                                  $10
   28    20    >   FETCH_STATIC_PROP_R          unknown             ~13     'someMap'
         21      > RETURN                                                   ~13
   29    22*     > RETURN                                                   null

End of function setmap

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.85 ms | 945 KiB | 18 Q