3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayObjectChild extends ArrayObject { public function offsetExists($offset) { var_dump('Called: '.__METHOD__); return parent::offsetExists($offset); } public function offsetGet($offset) { var_dump('Called: '.__METHOD__); return parent::offsetGet($offset); } } $array = array('foo' => ''); echo "ArrayObject: empty string is set, but empty:\n"; $object = new ArrayObject($array); var_dump(isset($object['foo']), empty($object['foo']), $object->offsetExists('foo')); echo "ArrayObject extended: empty string is set, but not empty\n"; $object = new ArrayObjectChild($array); var_dump(isset($object['foo']), empty($object['foo']), $object->offsetExists('foo'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DmQOU
function name:  (null)
number of ops:  32
compiled vars:  !0 = $array, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, <array>
   18     1        ECHO                                                     'ArrayObject%3A+empty+string+is+set%2C+but+empty%3A%0A'
   19     2        NEW                                              $3      'ArrayObject'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
   20     6        INIT_FCALL                                               'var_dump'
          7        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !1, 'foo'
          8        SEND_VAL                                                 ~6
          9        ISSET_ISEMPTY_DIM_OBJ                         1  ~7      !1, 'foo'
         10        SEND_VAL                                                 ~7
         11        INIT_METHOD_CALL                                         !1, 'offsetExists'
         12        SEND_VAL_EX                                              'foo'
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                                 
   22    16        ECHO                                                     'ArrayObject+extended%3A+empty+string+is+set%2C+but+not+empty%0A'
   23    17        NEW                                              $10     'ArrayObjectChild'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !1, $10
   24    21        INIT_FCALL                                               'var_dump'
         22        ISSET_ISEMPTY_DIM_OBJ                         0  ~13     !1, 'foo'
         23        SEND_VAL                                                 ~13
         24        ISSET_ISEMPTY_DIM_OBJ                         1  ~14     !1, 'foo'
         25        SEND_VAL                                                 ~14
         26        INIT_METHOD_CALL                                         !1, 'offsetExists'
         27        SEND_VAL_EX                                              'foo'
         28        DO_FCALL                                      0  $15     
         29        SEND_VAR                                                 $15
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Class ArrayObjectChild:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DmQOU
function name:  offsetExists
number of ops:  9
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'Called%3A+ArrayObjectChild%3A%3AoffsetExists'
          3        DO_ICALL                                                 
    7     4        INIT_STATIC_METHOD_CALL                                  'offsetExists'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $2      
          7      > RETURN                                                   $2
    8     8*     > 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/DmQOU
function name:  offsetGet
number of ops:  9
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'Called%3A+ArrayObjectChild%3A%3AoffsetGet'
          3        DO_ICALL                                                 
   12     4        INIT_STATIC_METHOD_CALL                                  'offsetGet'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $2      
          7      > RETURN                                                   $2
   13     8*     > RETURN                                                   null

End of function offsetget

End of class ArrayObjectChild.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.06 ms | 1400 KiB | 15 Q