3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ 'abc' => 46, 'def' => 134, 'xyz' => 34, //'qwe' => 39, ]; $array2 = [ 'abc' => 46, 'def' => 134, 'xyz' => 34, 'qwe' => 39, ]; function allKeysFoundInBothArrays(array $array1, array $array2): bool { foreach ($array1 as $key => $notUsed) { echo "checking $key in \$array2\n"; if (!key_exists($key, $array2)) { return false; } unset($array2[$key]); } foreach ($array2 as $key => $notUsed) { echo "checking $key in \$array1\n"; if (!key_exists($key, $array1)) { return false; } } return true; } var_export(allKeysFoundInBothArrays($array1, $array2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mRaTq
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array1, !1 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   36     2        INIT_FCALL                                               'var_export'
          3        INIT_FCALL                                               'allkeysfoundinbotharrays'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function allkeysfoundinbotharrays:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 36
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 36
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 19
filename:       /in/mRaTq
function name:  allKeysFoundInBothArrays
number of ops:  40
compiled vars:  !0 = $array1, !1 = $array2, !2 = $notUsed, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2      > FE_RESET_R                                       $4      !0, ->19
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->19
          4    >   ASSIGN                                                   !3, ~5
   21     5        ROPE_INIT                                     3  ~8      'checking+'
          6        ROPE_ADD                                      1  ~8      ~8, !3
          7        ROPE_END                                      2  ~7      ~8, '+in+%24array2%0A'
          8        ECHO                                                     ~7
   22     9        INIT_FCALL                                               'key_exists'
         10        SEND_VAR                                                 !3
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $10     
         13        BOOL_NOT                                         ~11     $10
         14      > JMPZ                                                     ~11, ->17
   23    15    >   FE_FREE                                                  $4
         16      > RETURN                                                   <false>
   25    17    >   UNSET_DIM                                                !1, !3
   20    18      > JMP                                                      ->3
         19    >   FE_FREE                                                  $4
   27    20      > FE_RESET_R                                       $12     !1, ->36
         21    > > FE_FETCH_R                                       ~13     $12, !2, ->36
         22    >   ASSIGN                                                   !3, ~13
   28    23        ROPE_INIT                                     3  ~16     'checking+'
         24        ROPE_ADD                                      1  ~16     ~16, !3
         25        ROPE_END                                      2  ~15     ~16, '+in+%24array1%0A'
         26        ECHO                                                     ~15
   29    27        INIT_FCALL                                               'key_exists'
         28        SEND_VAR                                                 !3
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $18     
         31        BOOL_NOT                                         ~19     $18
         32      > JMPZ                                                     ~19, ->35
   30    33    >   FE_FREE                                                  $12
         34      > RETURN                                                   <false>
   27    35    > > JMP                                                      ->21
         36    >   FE_FREE                                                  $12
   33    37      > RETURN                                                   <true>
   34    38*       VERIFY_RETURN_TYPE                                       
         39*     > RETURN                                                   null

End of function allkeysfoundinbotharrays

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.71 ms | 1013 KiB | 16 Q