3v4l.org

run code in 200+ PHP versions simultaneously
<?php $a = []; $keys = [ 'array' => [], 'object' => new stdClass, 'closure' => function () {}, 'class' => new class {}, 'class with tostring' => new class {function __toString(){return 'to string class';}}, 'resource' => fopen(__FILE__, 'r'), ]; foreach ($keys as $desc =>$key) { echo "===" . $desc . "===\n"; $a[$key] = true; echo "state of array: \n"; var_dump($a); echo "state of key: \n"; var_dump($key); echo "is the key set in the array: \n"; var_dump(isset($a[$key])); } echo "===============\n"; var_dump($a);
based on 3lpob
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 43
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 43
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
filename:       /in/cQ8hf
function name:  (null)
number of ops:  49
compiled vars:  !0 = $a, !1 = $keys, !2 = $key, !3 = $desc
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   QM_ASSIGN                                                !0
   6     1        INIT_ARRAY                                       ~5      <array>, 'array'
   7     2        NEW                                              $6      :92
         3        DO_FCALL                                      0          
         4        ADD_ARRAY_ELEMENT                                ~5      $6, 'object'
   8     5        RAISE_ABSTRACT_ERROR                             ~8      '%00%7Bclosure%7D%2Fin%2FcQ8hf0x7f7872e6e06c'
         6        ADD_ARRAY_ELEMENT                                ~5      ~8, 'closure'
   9     7        VERIFY_ABSTRACT_CLASS                            $9      'class%40anonymous%00%2Fin%2Fcq8hf0x7f7872e6e08a'
         8        NEW                                              $10     :9
         9        DO_FCALL                                      0          
        10        ADD_ARRAY_ELEMENT                                ~5      $10, 'class'
  10    11        VERIFY_ABSTRACT_CLASS                            $12     'class%40anonymous%00%2Fin%2Fcq8hf0x7f7872e6e0e6'
        12        NEW                                              $13     :12
        13        DO_FCALL                                      0          
        14        ADD_ARRAY_ELEMENT                                ~5      $13, 'class+with+tostring'
  11    15        INIT_FCALL                                               'fopen'
        16        SEND_VAL                                                 '%2Fin%2FcQ8hf'
        17        SEND_VAL                                                 'r'
        18        DO_ICALL                                         $15     
        19        ADD_ARRAY_ELEMENT                                ~5      $15, 'resource'
        20        QM_ASSIGN                                                !1
  14    21      > FE_RESET_R                                       $17     !1, ->43
        22    > > FE_FETCH_R                                       ~18     $17, !2, ->43
        23    >   QM_ASSIGN                                                !3
  15    24        CONCAT                                           ~20     '%3D%3D%3D', !3
        25        CONCAT                                           ~21     ~20, '%3D%3D%3D%0A'
        26        ASSIGN_OBJ                                               ~21
  16    27        ASSIGN_ADD                                    0          !0, !2
        28        OP_DATA                                                  <true>
  17    29        ASSIGN_OBJ                                               'state+of+array%3A+%0A'
  18    30        INIT_FCALL                                               'var_dump'
        31        SEND_VAR                                                 !0
        32        DO_ICALL                                                 
  19    33        ASSIGN_OBJ                                               'state+of+key%3A+%0A'
  20    34        INIT_FCALL                                               'var_dump'
        35        SEND_VAR                                                 !2
        36        DO_ICALL                                                 
  21    37        ASSIGN_OBJ                                               'is+the+key+set+in+the+array%3A+%0A'
  22    38        INIT_FCALL                                               'var_dump'
        39        ISSET_ISEMPTY_DIM_OBJ                         0  ~25     !0, !2
        40        SEND_VAL                                                 ~25
        41        DO_ICALL                                                 
  14    42      > JMP                                                      ->22
        43    >   FE_FREE                                                  $17
  25    44        ASSIGN_OBJ                                               '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A'
  26    45        INIT_FCALL                                               'var_dump'
        46        SEND_VAR                                                 !0
        47        DO_ICALL                                                 
        48      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FcQ8hf0x7f7872e6e06c:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cQ8hf
function name:  {closure}
number of ops:  1
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   8     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FcQ8hf0x7f7872e6e06c

Class class@anonymous: [no user functions]
Class class@anonymous:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cQ8hf
function name:  __toString
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  10     0  E > > RETURN                                                   'to+string+class'
         1*     > RETURN                                                   null

End of function __tostring

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 7.4.0