3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyStuff extends ArrayObject { function offsetGet($offset) { echo "Called", PHP_EOL; return parent::offsetGet($offset); } } $array = array( 'foo' => 42, 'baz' => null, ); $array_object = new MyStuff($array); // existing key, non-null value: assert(isset($array['foo']) === true); assert(empty($array['foo']) === false); assert(isset($array_object['foo']) === true); assert(empty($array_object['foo']) === false); // non-existing key: assert(isset($array['bar']) === false); assert(empty($array['bar']) === true); assert(isset($array_object['bar']) === false); assert(empty($array_object['bar']) === true); // key where value is null: assert(isset($array['baz']) === false); assert(empty($array['baz']) === true); assert(isset($array_object['baz']) === false); assert(empty($array_object['baz']) === true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kfehh
function name:  (null)
number of ops:  90
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        ASSERT_CHECK                                             
          6        INIT_FCALL                                               'assert'
          7        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !0, 'foo'
          8        TYPE_CHECK                                    8  ~7      ~6
          9        SEND_VAL                                                 ~7
         10        SEND_VAL                                                 'assert%28isset%28%24array%5B%27foo%27%5D%29+%3D%3D%3D+true%29'
         11        DO_ICALL                                                 
   19    12        ASSERT_CHECK                                             
         13        INIT_FCALL                                               'assert'
         14        ISSET_ISEMPTY_DIM_OBJ                         1  ~9      !0, 'foo'
         15        TYPE_CHECK                                    4  ~10     ~9
         16        SEND_VAL                                                 ~10
         17        SEND_VAL                                                 'assert%28empty%28%24array%5B%27foo%27%5D%29+%3D%3D%3D+false%29'
         18        DO_ICALL                                                 
   21    19        ASSERT_CHECK                                             
         20        INIT_FCALL                                               'assert'
         21        ISSET_ISEMPTY_DIM_OBJ                         0  ~12     !1, 'foo'
         22        TYPE_CHECK                                    8  ~13     ~12
         23        SEND_VAL                                                 ~13
         24        SEND_VAL                                                 'assert%28isset%28%24array_object%5B%27foo%27%5D%29+%3D%3D%3D+true%29'
         25        DO_ICALL                                                 
   22    26        ASSERT_CHECK                                             
         27        INIT_FCALL                                               'assert'
         28        ISSET_ISEMPTY_DIM_OBJ                         1  ~15     !1, 'foo'
         29        TYPE_CHECK                                    4  ~16     ~15
         30        SEND_VAL                                                 ~16
         31        SEND_VAL                                                 'assert%28empty%28%24array_object%5B%27foo%27%5D%29+%3D%3D%3D+false%29'
         32        DO_ICALL                                                 
   25    33        ASSERT_CHECK                                             
         34        INIT_FCALL                                               'assert'
         35        ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !0, 'bar'
         36        TYPE_CHECK                                    4  ~19     ~18
         37        SEND_VAL                                                 ~19
         38        SEND_VAL                                                 'assert%28isset%28%24array%5B%27bar%27%5D%29+%3D%3D%3D+false%29'
         39        DO_ICALL                                                 
   26    40        ASSERT_CHECK                                             
         41        INIT_FCALL                                               'assert'
         42        ISSET_ISEMPTY_DIM_OBJ                         1  ~21     !0, 'bar'
         43        TYPE_CHECK                                    8  ~22     ~21
         44        SEND_VAL                                                 ~22
         45        SEND_VAL                                                 'assert%28empty%28%24array%5B%27bar%27%5D%29+%3D%3D%3D+true%29'
         46        DO_ICALL                                                 
   28    47        ASSERT_CHECK                                             
         48        INIT_FCALL                                               'assert'
         49        ISSET_ISEMPTY_DIM_OBJ                         0  ~24     !1, 'bar'
         50        TYPE_CHECK                                    4  ~25     ~24
         51        SEND_VAL                                                 ~25
         52        SEND_VAL                                                 'assert%28isset%28%24array_object%5B%27bar%27%5D%29+%3D%3D%3D+false%29'
         53        DO_ICALL                                                 
   29    54        ASSERT_CHECK                                             
         55        INIT_FCALL                                               'assert'
         56        ISSET_ISEMPTY_DIM_OBJ                         1  ~27     !1, 'bar'
         57        TYPE_CHECK                                    8  ~28     ~27
         58        SEND_VAL                                                 ~28
         59        SEND_VAL                                                 'assert%28empty%28%24array_object%5B%27bar%27%5D%29+%3D%3D%3D+true%29'
         60        DO_ICALL                                                 
   32    61        ASSERT_CHECK                                             
         62        INIT_FCALL                                               'assert'
         63        ISSET_ISEMPTY_DIM_OBJ                         0  ~30     !0, 'baz'
         64        TYPE_CHECK                                    4  ~31     ~30
         65        SEND_VAL                                                 ~31
         66        SEND_VAL                                                 'assert%28isset%28%24array%5B%27baz%27%5D%29+%3D%3D%3D+false%29'
         67        DO_ICALL                                                 
   33    68        ASSERT_CHECK                                             
         69        INIT_FCALL                                               'assert'
         70        ISSET_ISEMPTY_DIM_OBJ                         1  ~33     !0, 'baz'
         71        TYPE_CHECK                                    8  ~34     ~33
         72        SEND_VAL                                                 ~34
         73        SEND_VAL                                                 'assert%28empty%28%24array%5B%27baz%27%5D%29+%3D%3D%3D+true%29'
         74        DO_ICALL                                                 
   35    75        ASSERT_CHECK                                             
         76        INIT_FCALL                                               'assert'
         77        ISSET_ISEMPTY_DIM_OBJ                         0  ~36     !1, 'baz'
         78        TYPE_CHECK                                    4  ~37     ~36
         79        SEND_VAL                                                 ~37
         80        SEND_VAL                                                 'assert%28isset%28%24array_object%5B%27baz%27%5D%29+%3D%3D%3D+false%29'
         81        DO_ICALL                                                 
   36    82        ASSERT_CHECK                                             
         83        INIT_FCALL                                               'assert'
         84        ISSET_ISEMPTY_DIM_OBJ                         1  ~39     !1, 'baz'
         85        TYPE_CHECK                                    8  ~40     ~39
         86        SEND_VAL                                                 ~40
         87        SEND_VAL                                                 'assert%28empty%28%24array_object%5B%27baz%27%5D%29+%3D%3D%3D+true%29'
         88        DO_ICALL                                                 
         89      > RETURN                                                   1

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

End of function offsetget

End of class MyStuff.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.05 ms | 1404 KiB | 15 Q