3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C implements ArrayAccess { public $data = array( "foo" => null ); public function offsetExists($offset): bool { return array_key_exists((string)$offset, $this->data); } public function offsetGet($offset) { return $this->data[$offset]; } public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } public function offsetUnset($offset): void { unset($this->data[$offset]); } } $o = new C(); var_dump(isset($o['foo'])); var_dump(property_exists($o, 'foo')); var_dump(array_key_exists('foo', $o)); var_dump(array_key_exists('foo', ['foo' => null]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/heZmC
function name:  (null)
number of ops:  24
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'c'
   26     1        NEW                                              $1      'C'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   28     4        INIT_FCALL                                               'var_dump'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      !0, 'foo'
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
   29     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'property_exists'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'foo'
         12        DO_ICALL                                         $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
   30    15        INIT_FCALL                                               'var_dump'
         16        ARRAY_KEY_EXISTS                                 ~8      'foo', !0
         17        SEND_VAL                                                 ~8
         18        DO_ICALL                                                 
   31    19        INIT_FCALL                                               'var_dump'
         20        ARRAY_KEY_EXISTS                                 ~10     'foo', <array>
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Class C:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/heZmC
function name:  offsetExists
number of ops:  8
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        CAST                                          6  ~1      !0
          2        FETCH_OBJ_R                                      ~2      'data'
          3        ARRAY_KEY_EXISTS                                 ~3      ~1, ~2
          4        VERIFY_RETURN_TYPE                                       ~3
          5      > RETURN                                                   ~3
   11     6*       VERIFY_RETURN_TYPE                                       
          7*     > 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/heZmC
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_R                                      ~1      'data'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
   15     4*     > 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/heZmC
function name:  offsetSet
number of ops:  6
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        FETCH_OBJ_W                                      $2      'data'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   19     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/heZmC
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        FETCH_OBJ_UNSET                                  $1      'data'
          2        UNSET_DIM                                                $1, !0
   23     3      > RETURN                                                   null

End of function offsetunset

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.56 ms | 1006 KiB | 15 Q