3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CFG { private static $data = []; public static function set($key, $value) { self::$data[$key] = $value; } public static function get($key) { if (isset(self::$data[$key])) { return self::$data[$key]; } throw new Exception('Key not set'); } } CFG::set('foo', 'bar'); echo CFG::get('baz');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8mU7m
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_STATIC_METHOD_CALL                                  'CFG', 'set'
          1        SEND_VAL                                                 'foo'
          2        SEND_VAL                                                 'bar'
          3        DO_FCALL                                      0          
   23     4        INIT_STATIC_METHOD_CALL                                  'CFG', 'get'
          5        SEND_VAL                                                 'baz'
          6        DO_FCALL                                      0  $1      
          7        ECHO                                                     $1
          8      > RETURN                                                   1

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

End of function set

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/8mU7m
function name:  get
number of ops:  12
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_STATIC_PROP_IS                             ~1      'data'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->7
   15     4    >   FETCH_STATIC_PROP_R          unknown             ~3      'data'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6      > RETURN                                                   ~4
   18     7    >   NEW                                              $5      'Exception'
          8        SEND_VAL_EX                                              'Key+not+set'
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $5
   19    11*     > RETURN                                                   null

End of function get

End of class CFG.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.02 ms | 1395 KiB | 13 Q