3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Registry { public $data = []; public function __get($var) { return $this->data[$var] ?? null; } public function get($var, $default) { if (!array_key_exists($var, $this->data)) { return $default; } } } $reg = new Registry; var_dump($reg->empty); var_dump(strtoupper($reg->empty)); var_dump($reg->get('empty', 'empty')); var_dump(strtoupper($reg->get('empty', 'empty')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s9DIE
function name:  (null)
number of ops:  32
compiled vars:  !0 = $reg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'Registry'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'empty'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   25     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'strtoupper'
          9        FETCH_OBJ_R                                      ~6      !0, 'empty'
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
   28    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !0, 'get'
         16        SEND_VAL_EX                                              'empty'
         17        SEND_VAL_EX                                              'empty'
         18        DO_FCALL                                      0  $9      
         19        SEND_VAR                                                 $9
         20        DO_ICALL                                                 
   29    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'strtoupper'
         23        INIT_METHOD_CALL                                         !0, 'get'
         24        SEND_VAL_EX                                              'empty'
         25        SEND_VAL_EX                                              'empty'
         26        DO_FCALL                                      0  $11     
         27        SEND_VAR                                                 $11
         28        DO_ICALL                                         $12     
         29        SEND_VAR                                                 $12
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Class Registry:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s9DIE
function name:  __get
number of ops:  7
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_OBJ_IS                                     ~1      'data'
          2        FETCH_DIM_IS                                     ~2      ~1, !0
          3        COALESCE                                         ~3      ~2
          4        QM_ASSIGN                                        ~3      null
          5      > RETURN                                                   ~3
    9     6*     > RETURN                                                   null

End of function __get

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s9DIE
function name:  get
number of ops:  8
compiled vars:  !0 = $var, !1 = $default
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        FETCH_OBJ_R                                      ~2      'data'
          3        ARRAY_KEY_EXISTS                                 ~3      !0, ~2
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->7
   13     6    > > RETURN                                                   !1
   16     7    > > RETURN                                                   null

End of function get

End of class Registry.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.32 ms | 1008 KiB | 15 Q