3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ 'a1' => ['a_name' => 'aaaaa', 'a_value' => 'aaa'], 'b1' => ['b_name' => 'bbbbb', 'b_value' => 'bbb'], 'c1' => ['c_name' => 'ccccc', 'c_value' => 'ccc'], ]; $array2 = ['b1' => ['b_name' => 'bbbbb'], 'c1' => ['a_value' => 'aaa']]; $result = array_intersect_key($array1, $array2); foreach ($result as $key => &$value) { $value = array_intersect_key($value, $array2[$key]); if (!$value) { unset($result[$key]); } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/aLDJV
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'array_intersect_key'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
   13     7      > FE_RESET_RW                                      $9      !2, ->20
          8    > > FE_FETCH_RW                                      ~10     $9, !3, ->20
          9    >   ASSIGN                                                   !4, ~10
   14    10        INIT_FCALL                                               'array_intersect_key'
         11        SEND_VAR                                                 !3
         12        FETCH_DIM_R                                      ~12     !1, !4
         13        SEND_VAL                                                 ~12
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !3, $13
   15    16        BOOL_NOT                                         ~15     !3
         17      > JMPZ                                                     ~15, ->19
   16    18    >   UNSET_DIM                                                !2, !4
   13    19    > > JMP                                                      ->8
         20    >   FE_FREE                                                  $9
   19    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.17 ms | 1073 KiB | 15 Q