3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyStuff extends ArrayObject { function offsetGet($offset) { echo "Called"; return parent::offsetGet($offset); } } $array = array( 'foo' => 42, 'baz' => null, ); $array_object = new MyStuff($array); // existing key, non-null value: var_dump(isset($array['foo'])); //true var_dump(empty($array['foo'])); //false var_dump(isset($array_object['foo'])); //true var_dump(empty($array_object['foo'])); //false // non-existing key: var_dump(isset($array['bar'])); //false var_dump(empty($array['bar'])); //true var_dump(isset($array_object['bar'])); //true var_dump(empty($array_object['bar'])); //false // key where value is null: var_dump(isset($array['baz'])); //false var_dump(empty($array['baz'])); //true var_dump(isset($array_object['baz'])); //true var_dump(empty($array_object['baz'])); //false
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rU77c
function name:  (null)
number of ops:  54
compiled vars:  !0 = $array, !1 = $array_object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   15     1        NEW                                              $3      'MyStuff'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   18     5        INIT_FCALL                                               'var_dump'
          6        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !0, 'foo'
          7        SEND_VAL                                                 ~6
          8        DO_ICALL                                                 
   19     9        INIT_FCALL                                               'var_dump'
         10        ISSET_ISEMPTY_DIM_OBJ                         1  ~8      !0, 'foo'
         11        SEND_VAL                                                 ~8
         12        DO_ICALL                                                 
   21    13        INIT_FCALL                                               'var_dump'
         14        ISSET_ISEMPTY_DIM_OBJ                         0  ~10     !1, 'foo'
         15        SEND_VAL                                                 ~10
         16        DO_ICALL                                                 
   22    17        INIT_FCALL                                               'var_dump'
         18        ISSET_ISEMPTY_DIM_OBJ                         1  ~12     !1, 'foo'
         19        SEND_VAL                                                 ~12
         20        DO_ICALL                                                 
   26    21        INIT_FCALL                                               'var_dump'
         22        ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !0, 'bar'
         23        SEND_VAL                                                 ~14
         24        DO_ICALL                                                 
   27    25        INIT_FCALL                                               'var_dump'
         26        ISSET_ISEMPTY_DIM_OBJ                         1  ~16     !0, 'bar'
         27        SEND_VAL                                                 ~16
         28        DO_ICALL                                                 
   29    29        INIT_FCALL                                               'var_dump'
         30        ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !1, 'bar'
         31        SEND_VAL                                                 ~18
         32        DO_ICALL                                                 
   30    33        INIT_FCALL                                               'var_dump'
         34        ISSET_ISEMPTY_DIM_OBJ                         1  ~20     !1, 'bar'
         35        SEND_VAL                                                 ~20
         36        DO_ICALL                                                 
   33    37        INIT_FCALL                                               'var_dump'
         38        ISSET_ISEMPTY_DIM_OBJ                         0  ~22     !0, 'baz'
         39        SEND_VAL                                                 ~22
         40        DO_ICALL                                                 
   34    41        INIT_FCALL                                               'var_dump'
         42        ISSET_ISEMPTY_DIM_OBJ                         1  ~24     !0, 'baz'
         43        SEND_VAL                                                 ~24
         44        DO_ICALL                                                 
   36    45        INIT_FCALL                                               'var_dump'
         46        ISSET_ISEMPTY_DIM_OBJ                         0  ~26     !1, 'baz'
         47        SEND_VAL                                                 ~26
         48        DO_ICALL                                                 
   37    49        INIT_FCALL                                               'var_dump'
         50        ISSET_ISEMPTY_DIM_OBJ                         1  ~28     !1, 'baz'
         51        SEND_VAL                                                 ~28
         52        DO_ICALL                                                 
         53      > RETURN                                                   1

Class MyStuff:
Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rU77c
function name:  offsetGet
number of ops:  7
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ECHO                                                     'Called'
    6     2        INIT_STATIC_METHOD_CALL                                  'offsetGet'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
    7     6*     > RETURN                                                   null

End of function offsetget

End of class MyStuff.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.4 ms | 1400 KiB | 15 Q