3v4l.org

run code in 500+ PHP versions simultaneously
<?php class IssetArray extends \ArrayObject { public function &offsetGet($offset) { $var = $this->offsetExists($offset) ? parent::offsetGet($offset) : null; return $var; } } $array = new \IssetArray(); $array['item'] = 123; var_dump($array['item']); var_dump($array['item']['foo']); var_dump($array['something']['noItem']); $array['something']['foo'] = 'bar'; var_dump($array['something']['foo']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nAi6h
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   NEW                                                  $1      'IssetArray'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   13     3        ASSIGN_DIM                                                   !0, 'item'
          4        OP_DATA                                                      123
   14     5        INIT_FCALL                                                   'var_dump'
          6        FETCH_DIM_R                                          ~5      !0, 'item'
          7        SEND_VAL                                                     ~5
          8        DO_ICALL                                                     
   15     9        INIT_FCALL                                                   'var_dump'
         10        FETCH_DIM_R                                          ~7      !0, 'item'
         11        FETCH_DIM_R                                          ~8      ~7, 'foo'
         12        SEND_VAL                                                     ~8
         13        DO_ICALL                                                     
   16    14        INIT_FCALL                                                   'var_dump'
         15        FETCH_DIM_R                                          ~10     !0, 'something'
         16        FETCH_DIM_R                                          ~11     ~10, 'noItem'
         17        SEND_VAL                                                     ~11
         18        DO_ICALL                                                     
   18    19        FETCH_DIM_W                                          $13     !0, 'something'
         20        ASSIGN_DIM                                                   $13, 'foo'
         21        OP_DATA                                                      'bar'
   19    22        INIT_FCALL                                                   'var_dump'
         23        FETCH_DIM_R                                          ~15     !0, 'something'
         24        FETCH_DIM_R                                          ~16     ~15, 'foo'
         25        SEND_VAL                                                     ~16
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Class IssetArray:
Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Return found
Branch analysis from position: 10
Return found
filename:       /in/nAi6h
function name:  offsetGet
number of ops:  14
compiled vars:  !0 = $offset, !1 = $var
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    6     1        INIT_METHOD_CALL                                             'offsetExists'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0  $2      
          4      > JMPZ                                                         $2, ->10
          5    >   INIT_STATIC_METHOD_CALL                                      'offsetGet'
          6        SEND_VAR_EX                                                  !0
          7        DO_FCALL                                          0  $3      
          8        QM_ASSIGN                                            ~4      $3
          9      > JMP                                                          ->11
         10    >   QM_ASSIGN                                            ~4      null
         11    >   ASSIGN                                                       !1, ~4
    7    12      > RETURN_BY_REF                                                !1
    8    13*     > RETURN_BY_REF                                                null

End of function offsetget

End of class IssetArray.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
210.74 ms | 2786 KiB | 14 Q