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'), $object->offsetGet('foo'), $object['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'), $object->offsetGet('foo'), $object['foo']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XCXqX
function name:  (null)
number of ops:  44
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        INIT_METHOD_CALL                                         !1, 'offsetGet'
         16        SEND_VAL_EX                                              'foo'
         17        DO_FCALL                                      0  $9      
         18        SEND_VAR                                                 $9
         19        FETCH_DIM_R                                      ~10     !1, 'foo'
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                                 
   22    22        ECHO                                                     'ArrayObject+extended%3A+empty+string+is+set%2C+but+not+empty%0A'
   23    23        NEW                                              $12     'ArrayObjectChild'
         24        SEND_VAR_EX                                              !0
         25        DO_FCALL                                      0          
         26        ASSIGN                                                   !1, $12
   24    27        INIT_FCALL                                               'var_dump'
         28        ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !1, 'foo'
         29        SEND_VAL                                                 ~15
         30        ISSET_ISEMPTY_DIM_OBJ                         1  ~16     !1, 'foo'
         31        SEND_VAL                                                 ~16
         32        INIT_METHOD_CALL                                         !1, 'offsetExists'
         33        SEND_VAL_EX                                              'foo'
         34        DO_FCALL                                      0  $17     
         35        SEND_VAR                                                 $17
         36        INIT_METHOD_CALL                                         !1, 'offsetGet'
         37        SEND_VAL_EX                                              'foo'
         38        DO_FCALL                                      0  $18     
         39        SEND_VAR                                                 $18
         40        FETCH_DIM_R                                      ~19     !1, 'foo'
         41        SEND_VAL                                                 ~19
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Class ArrayObjectChild:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XCXqX
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/XCXqX
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:
173.5 ms | 1400 KiB | 15 Q