3v4l.org

run code in 300+ PHP versions simultaneously
<?php $whiteList = [ ['code' => '123', 'name' => 'ABC',], ['code' => '456', 'name' => 'XYZ',], ]; $pricedList = [ ['code' => '123', 'name' => 'ABC', 'price' => '34'], ['code' => '456', 'name' => 'PQR', 'price' => '56'], ['name' => 'XYZ', 'code' => '456', 'price' => '90'], ['code' => '456', 'name' => 'GHI', 'price' => '70'], ]; $result = []; foreach ($pricedList as $pricedRow) { foreach ($whiteList as $whiteRow) { if ($whiteRow === array_intersect_assoc($whiteRow, $pricedRow)) { $result[] = $pricedRow; continue 2; // no reason to keep iterating inner loop after match is found } } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 18
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/gX7k7
function name:  (null)
number of ops:  25
compiled vars:  !0 = $whiteList, !1 = $pricedList, !2 = $result, !3 = $pricedRow, !4 = $whiteRow
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, <array>
   16     3      > FE_RESET_R                                       $8      !1, ->20
          4    > > FE_FETCH_R                                               $8, !3, ->20
   17     5    > > FE_RESET_R                                       $9      !0, ->18
          6    > > FE_FETCH_R                                               $9, !4, ->18
   18     7    >   INIT_FCALL                                               'array_intersect_assoc'
          8        SEND_VAR                                                 !4
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $10     
         11        IS_IDENTICAL                                             !4, $10
         12      > JMPZ                                                     ~11, ->17
   19    13    >   ASSIGN_DIM                                               !2
         14        OP_DATA                                                  !3
   20    15        FE_FREE                                                  $9
         16      > JMP                                                      ->4
   17    17    > > JMP                                                      ->6
         18    >   FE_FREE                                                  $9
   16    19      > JMP                                                      ->4
         20    >   FE_FREE                                                  $8
   24    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:
147.85 ms | 1012 KiB | 15 Q