3v4l.org

run code in 500+ PHP versions simultaneously
<?php class FormView implements \ArrayAccess { public array $vars = []; public function offsetExists($offset) { return array_key_exists($offset, $this->vars); } public function offsetGet($offset) { return $this->vars[$offset] ?? null; } public function offsetSet($offset, $value) { $this->vars[$offset] = $value; } public function offsetUnset($offset) { unset($this->vars[$offset]); } } $f = new FormView(); $f->offsetSet('as', 1); var_dump($f->offsetExists('as')); var_dump($f->offsetGet('as')); var_dump($f->as); echo "--\n"; $f = new FormView(); $f->as = 123; var_dump($f->offsetExists('as')); var_dump($f->offsetGet('as')); var_dump($f->as); echo "--\n"; $f = new FormView(); $f->offsetSet('as', null); var_dump($f->offsetExists('as')); var_dump($f->offsetGet('as')); var_dump($f->as);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2uhaE
function name:  (null)
number of ops:  71
compiled vars:  !0 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'formview'
   22     1        NEW                                                  $1      'FormView'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   23     4        INIT_METHOD_CALL                                             !0, 'offsetSet'
          5        SEND_VAL_EX                                                  'as'
          6        SEND_VAL_EX                                                  1
          7        DO_FCALL                                          0          
   24     8        INIT_FCALL                                                   'var_dump'
          9        INIT_METHOD_CALL                                             !0, 'offsetExists'
         10        SEND_VAL_EX                                                  'as'
         11        DO_FCALL                                          0  $5      
         12        SEND_VAR                                                     $5
         13        DO_ICALL                                                     
   25    14        INIT_FCALL                                                   'var_dump'
         15        INIT_METHOD_CALL                                             !0, 'offsetGet'
         16        SEND_VAL_EX                                                  'as'
         17        DO_FCALL                                          0  $7      
         18        SEND_VAR                                                     $7
         19        DO_ICALL                                                     
   26    20        INIT_FCALL                                                   'var_dump'
         21        FETCH_OBJ_R                                          ~9      !0, 'as'
         22        SEND_VAL                                                     ~9
         23        DO_ICALL                                                     
   28    24        ECHO                                                         '--%0A'
   30    25        NEW                                                  $11     'FormView'
         26        DO_FCALL                                          0          
         27        ASSIGN                                                       !0, $11
   31    28        ASSIGN_OBJ                                                   !0, 'as'
         29        OP_DATA                                                      123
   32    30        INIT_FCALL                                                   'var_dump'
         31        INIT_METHOD_CALL                                             !0, 'offsetExists'
         32        SEND_VAL_EX                                                  'as'
         33        DO_FCALL                                          0  $15     
         34        SEND_VAR                                                     $15
         35        DO_ICALL                                                     
   33    36        INIT_FCALL                                                   'var_dump'
         37        INIT_METHOD_CALL                                             !0, 'offsetGet'
         38        SEND_VAL_EX                                                  'as'
         39        DO_FCALL                                          0  $17     
         40        SEND_VAR                                                     $17
         41        DO_ICALL                                                     
   34    42        INIT_FCALL                                                   'var_dump'
         43        FETCH_OBJ_R                                          ~19     !0, 'as'
         44        SEND_VAL                                                     ~19
         45        DO_ICALL                                                     
   36    46        ECHO                                                         '--%0A'
   38    47        NEW                                                  $21     'FormView'
         48        DO_FCALL                                          0          
         49        ASSIGN                                                       !0, $21
   39    50        INIT_METHOD_CALL                                             !0, 'offsetSet'
         51        SEND_VAL_EX                                                  'as'
         52        SEND_VAL_EX                                                  null
         53        DO_FCALL                                          0          
   40    54        INIT_FCALL                                                   'var_dump'
         55        INIT_METHOD_CALL                                             !0, 'offsetExists'
         56        SEND_VAL_EX                                                  'as'
         57        DO_FCALL                                          0  $25     
         58        SEND_VAR                                                     $25
         59        DO_ICALL                                                     
   41    60        INIT_FCALL                                                   'var_dump'
         61        INIT_METHOD_CALL                                             !0, 'offsetGet'
         62        SEND_VAL_EX                                                  'as'
         63        DO_FCALL                                          0  $27     
         64        SEND_VAR                                                     $27
         65        DO_ICALL                                                     
   42    66        INIT_FCALL                                                   'var_dump'
         67        FETCH_OBJ_R                                          ~29     !0, 'as'
         68        SEND_VAL                                                     ~29
         69        DO_ICALL                                                     
         70      > RETURN                                                       1

Class FormView:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2uhaE
function name:  offsetExists
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    8     1        FETCH_OBJ_R                                          ~1      'vars'
          2        ARRAY_KEY_EXISTS                                     ~2      !0, ~1
          3      > RETURN                                                       ~2
    9     4*     > RETURN                                                       null

End of function offsetexists

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

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2uhaE
function name:  offsetSet
number of ops:  6
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   14     2        FETCH_OBJ_W                                          $2      'vars'
          3        ASSIGN_DIM                                                   $2, !0
          4        OP_DATA                                                      !1
   15     5      > RETURN                                                       null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2uhaE
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1        FETCH_OBJ_UNSET                                      $1      'vars'
          2        UNSET_DIM                                                    $1, !0
   19     3      > RETURN                                                       null

End of function offsetunset

End of class FormView.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
132.99 ms | 488 KiB | 8 Q