3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayHash extends \stdClass { public static function from(array $arr) { $obj = new static; foreach ($arr as $key => $value) { $obj->$key = $value; } return $obj; } } $one = array('abcdef' => 'xxx', '102787' => 'yyy'); $two = (array) ArrayHash::from($one); echo "# One\n"; var_dump($one); var_dump(isset($one['abcdef'])); var_dump(array_key_exists('abcdef', $one)); var_dump(isset($one[102787])); var_dump(array_key_exists(102787, $one)); var_dump(isset($one['102787'])); var_dump(array_key_exists('102787', $one)); echo "\n\n"; echo "# Two\n"; var_dump($two); var_dump(isset($two['abcdef'])); var_dump(array_key_exists('abcdef', $two)); var_dump(isset($two[102787])); var_dump(array_key_exists(102787, $two)); var_dump(isset($two['102787'])); var_dump(array_key_exists('102787', $two)); echo "\n\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ambbi
function name:  (null)
number of ops:  65
compiled vars:  !0 = $one, !1 = $two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_STATIC_METHOD_CALL                                  'ArrayHash', 'from'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        CAST                                          7  ~4      $3
          5        ASSIGN                                                   !1, ~4
   19     6        ECHO                                                     '%23+One%0A'
   20     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   21    10        INIT_FCALL                                               'var_dump'
         11        ISSET_ISEMPTY_DIM_OBJ                         0  ~7      !0, 'abcdef'
         12        SEND_VAL                                                 ~7
         13        DO_ICALL                                                 
   22    14        INIT_FCALL                                               'var_dump'
         15        ARRAY_KEY_EXISTS                                 ~9      'abcdef', !0
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                                 
   23    18        INIT_FCALL                                               'var_dump'
         19        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !0, 102787
         20        SEND_VAL                                                 ~11
         21        DO_ICALL                                                 
   24    22        INIT_FCALL                                               'var_dump'
         23        ARRAY_KEY_EXISTS                                 ~13     102787, !0
         24        SEND_VAL                                                 ~13
         25        DO_ICALL                                                 
   25    26        INIT_FCALL                                               'var_dump'
         27        ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !0, 102787
         28        SEND_VAL                                                 ~15
         29        DO_ICALL                                                 
   26    30        INIT_FCALL                                               'var_dump'
         31        ARRAY_KEY_EXISTS                                 ~17     '102787', !0
         32        SEND_VAL                                                 ~17
         33        DO_ICALL                                                 
   27    34        ECHO                                                     '%0A%0A'
   30    35        ECHO                                                     '%23+Two%0A'
   31    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                                 
   32    39        INIT_FCALL                                               'var_dump'
         40        ISSET_ISEMPTY_DIM_OBJ                         0  ~20     !1, 'abcdef'
         41        SEND_VAL                                                 ~20
         42        DO_ICALL                                                 
   33    43        INIT_FCALL                                               'var_dump'
         44        ARRAY_KEY_EXISTS                                 ~22     'abcdef', !1
         45        SEND_VAL                                                 ~22
         46        DO_ICALL                                                 
   34    47        INIT_FCALL                                               'var_dump'
         48        ISSET_ISEMPTY_DIM_OBJ                         0  ~24     !1, 102787
         49        SEND_VAL                                                 ~24
         50        DO_ICALL                                                 
   35    51        INIT_FCALL                                               'var_dump'
         52        ARRAY_KEY_EXISTS                                 ~26     102787, !1
         53        SEND_VAL                                                 ~26
         54        DO_ICALL                                                 
   36    55        INIT_FCALL                                               'var_dump'
         56        ISSET_ISEMPTY_DIM_OBJ                         0  ~28     !1, 102787
         57        SEND_VAL                                                 ~28
         58        DO_ICALL                                                 
   37    59        INIT_FCALL                                               'var_dump'
         60        ARRAY_KEY_EXISTS                                 ~30     '102787', !1
         61        SEND_VAL                                                 ~30
         62        DO_ICALL                                                 
   38    63        ECHO                                                     '%0A%0A'
         64      > RETURN                                                   1

Class ArrayHash:
Function from:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/ambbi
function name:  from
number of ops:  13
compiled vars:  !0 = $arr, !1 = $obj, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        NEW                          static              $4      
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
    8     4      > FE_RESET_R                                       $7      !0, ->10
          5    > > FE_FETCH_R                                       ~8      $7, !2, ->10
          6    >   ASSIGN                                                   !3, ~8
    9     7        ASSIGN_OBJ                                               !1, !3
          8        OP_DATA                                                  !2
    8     9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $7
   11    11      > RETURN                                                   !1
   12    12*     > RETURN                                                   null

End of function from

End of class ArrayHash.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.65 ms | 1400 KiB | 15 Q